memoize the creation of the name in the blame object
This commit is contained in:
parent
822938d9ae
commit
3f4cbcbfd8
|
@ -76,10 +76,17 @@
|
||||||
(unless positive
|
(unless positive
|
||||||
(raise-type-error 'make-blame "(not/c #f)" 3
|
(raise-type-error 'make-blame "(not/c #f)" 3
|
||||||
source value build-name positive negative original?))
|
source value build-name positive negative original?))
|
||||||
|
(define build/memo-name
|
||||||
|
(let* ([uniq (box #f)]
|
||||||
|
[ans uniq])
|
||||||
|
(λ ()
|
||||||
|
(when (eq? uniq ans)
|
||||||
|
(set! ans (build-name)))
|
||||||
|
ans)))
|
||||||
(make-blame
|
(make-blame
|
||||||
source
|
source
|
||||||
value
|
value
|
||||||
build-name
|
build/memo-name
|
||||||
(list positive)
|
(list positive)
|
||||||
(and negative (list negative))
|
(and negative (list negative))
|
||||||
original?
|
original?
|
||||||
|
|
Loading…
Reference in New Issue
Block a user