Add "transient" intmap interface
authorAndy Wingo <wingo@pobox.com>
Wed, 1 Apr 2015 08:01:16 +0000 (10:01 +0200)
committerAndy Wingo <wingo@pobox.com>
Wed, 8 Apr 2015 15:17:59 +0000 (17:17 +0200)
commit95db5705288c8f72cd81e52a2d94cd876dc6ea04
tree366e74decda701fcf9f6abeb243a76c9c7955089
parentcf512e32687b41690ab436f13322d7a9e00094b7
Add "transient" intmap interface

* module/language/cps/intmap.scm (make-atomic-reference):
  (get-atomic-reference, set-atomic-reference!): New helpers.
  (*branch-size-with-edit*, *edit-index*): Branches now have a trailing
  field, an atomic reference to their owner.
  (<transient-intmap>): New record type.  A mutable intmap.
  (new-branch): Set the "edit" field on the branch.
  (clone-branch-and-set): No editor for this field.
  (assert-readable!, writable-branch): New helpers.
  (transient-intmap, persistent-intmap): New exported functions.
  (intmap-add!): New function.
  (intmap-next, intmap-prev, intmap-ref): Work on transient intmaps.
  (intmap-fold): Persist the intmap before folding over it.
module/language/cps/intmap.scm