mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-18 21:29:19 +02:00
adding unambiguous promise? to core
This commit is contained in:
parent
887100b8ab
commit
bc3fa73ec4
2 changed files with 5 additions and 14 deletions
|
@ -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)
|
||||
|
|
|
@ -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))))
|
||||
|
|
Loading…
Add table
Reference in a new issue