Abdulaziz Ghuloum wrote:
BTW, I think the organization of the library is a little unwieldy (8
files in 5 hierarchical levels is a little too many). If I may suggest
that you revert to the single-library implementation that was there
before and use the following portable implementation for quote. Leave
it up to the individual implementors to choose better implementations if
they so wish. Code:
(define get-cached
(let ([h (make-eq-hashtable)])
(lambda (x)
(define (f x)
(cond
[(pair? x) (ir:cons (f (car x)) (f (cdr x)))]
[(vector? x) (vector-map f x)]
[else x]))
(cond
[(not (or (pair? x) (vector? x))) x]
[(hashtable-ref h x #f)]
[else
(let ([v (f x)])
(hashtable-set! h x v)
v)]))))
(define-syntax ir:quote
(syntax-rules ()
[(_ datum) (get-cached 'datum)]))
Thanks! I will add this to the reference implementation.
David