1 ! Copyright (C) 2004, 2006 Chris Double, Matthew Willis.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors arrays effects fry generalizations kernel math
4 namespaces parser sequences words ;
7 TUPLE: promise quot forced? value ;
9 : promise ( quot -- promise ) f f \ promise boa ;
11 : force ( promise -- value )
13 dup quot>> call( -- value ) >>value
18 : make-lazy-quot ( quot effect -- quot )
19 in>> length '[ _ _ ncurry promise ] ;
22 (:) [ make-lazy-quot ] [ 2nip ] 3bi define-declared ;