Closed stibear closed 8 years ago
It seems that all the call of make-promise%
followed by box
so why don't you define the combination as an procedure?
@stibear
Can you split the patch into two things, one for the first bug and the other for the second one? I can merge the second one immediately, while the first needs more discussion, I think.
Can we implement delay-force just like the following instead of using boxes?:
(define-syntax delay-force
(syntax-rules ()
((_ expr)
(letrec ((p (make-promise% #f (lambda ()
(let ((v (begin expr)))
(set-promise-done! p #t)
p)))))
p))))
I'm not sure if this works. And there are maybe more elegant solutions anyway.
@stibear
I made an alternative implementation using tri-state rather than boxes: https://github.com/picrin-scheme/picrin/tree/stibear-lazy
@nyuichi It looks no problem. I tested it and it passed all tests.
Ref: #339