box.scm 281 B

1234567891011121314151617
  1. #lang racket
  2. (provide box box-value set-box-value!
  3. assoc-box-set!)
  4. ;;; box based mutable assoc
  5. ;;
  6. (struct box ((value #:mutable)) #:transparent)
  7. (define (assoc-box-set! soc key value)
  8. (cond ((assoc soc key) =>
  9. (lambda (entry)
  10. (set-box-value! (cdr entry) value)))))