add kw support to make-caching-proc

dev-0.1
Matthew Butterick 8 years ago
parent e613f0cade
commit aaf3d8fe53

@ -4,8 +4,9 @@
(define+provide+safe (make-caching-proc base-proc)
(procedure? . -> . procedure?)
(let ([cache (make-hash)])
(λ args
(hash-ref! cache args (λ () (apply base-proc args))))))
(make-keyword-procedure
(λ (kws kw-args . args)
(hash-ref! cache args (λ () (keyword-apply base-proc kws kw-args args)))))))
(provide+safe define/caching)
(define-syntax (define/caching stx)

Loading…
Cancel
Save