Commits

Moritz Heidkamp committed 85d804a

Turn box into typed-record

Performance is equal or better than the custom inline variant.

Comments (0)

Files changed (1)

persistent-hash-map.scm

                     args
                     body))))))))
 
-(define-type box pair)
+(define-type box (struct box))
 
-(: box (* -> box))
-(define-inline (box x)
-  (cons 'box x))
-
-(: box (box * ->))
-(define-inline (box-set! box x)
-  (set-cdr! box x))
-
-(: box-ref (box -> *))
-(define-inline (box-ref box)
-  (cdr box))
+(define-record-type box
+  (box val)
+  box?
+  (val box-ref box-set!))
 
 (: inode-kv-reduce (vector (* * * -> *) * -> *))
 (define (inode-kv-reduce vec f init)