adding unambiguous promise? to core

This commit is contained in:
Alex Shinn 2017-11-08 22:56:02 +09:00
parent 887100b8ab
commit bc3fa73ec4
2 changed files with 5 additions and 14 deletions

View file

@ -1079,8 +1079,11 @@
(auto-force
)
(else
(define *promise-tag* (list 'promise))
(define (promise done? proc)
(list (cons done? proc)))
(cons (cons done? proc) *promise-tag*))
(define (promise? x)
(and (pair? x) (eq? *promise-tag* (cdr x))))
(define (promise-done? x) (car (car x)))
(define (promise-value x) (cdr (car x)))
(define (promise-update! new old)

View file

@ -4,16 +4,4 @@
(export delay force delay-force make-promise promise?)
(begin
(define (make-promise x)
(delay x)))
(cond-expand
(auto-force
)
(else
(begin
(define (promise? x)
(and (pair? x)
(null? (cdr x))
(pair? (car x))
(or (eq? #t (caar x))
(and (eq? #f (caar x))
(procedure? (cdar x))))))))))
(delay x))))