new accessors in promises

db4
Doug Coleman 2008-08-29 01:53:34 -05:00
parent 92fe9cfb45
commit 475a96dcb7
1 changed files with 6 additions and 6 deletions

View File

@ -5,7 +5,7 @@
! Updated by Chris Double, September 2006 ! Updated by Chris Double, September 2006
USING: arrays kernel sequences math vectors arrays namespaces USING: arrays kernel sequences math vectors arrays namespaces
quotations parser effects stack-checker words ; quotations parser effects stack-checker words accessors ;
IN: promises IN: promises
TUPLE: promise quot forced? value ; TUPLE: promise quot forced? value ;
@ -23,14 +23,14 @@ TUPLE: promise quot forced? value ;
#! Force the given promise leaving the value of calling the #! Force the given promise leaving the value of calling the
#! promises quotation on the stack. Re-forcing the promise #! promises quotation on the stack. Re-forcing the promise
#! will return the same value and not recall the quotation. #! will return the same value and not recall the quotation.
dup promise-forced? [ dup forced?>> [
dup promise-quot call over set-promise-value dup quot>> call >>value
t over set-promise-forced? t >>forced?
] unless ] unless
promise-value ; value>> ;
: stack-effect-in ( quot word -- n ) : stack-effect-in ( quot word -- n )
stack-effect [ ] [ infer ] ?if effect-in length ; stack-effect [ ] [ infer ] ?if in>> length ;
: make-lazy-quot ( word quot -- quot ) : make-lazy-quot ( word quot -- quot )
[ [