]> gitweb.factorcode.org Git - factor.git/blob - libs/lazy-lists/lazy.factor
7b96bfa37b788168c608cb3d40dee2c42b437e79
[factor.git] / libs / lazy-lists / lazy.factor
1 ! Copyright (C) 2004 Chris Double.
2 ! See http://factorcode.org/license.txt for BSD license.
3 !
4 USING: kernel sequences words inference namespaces math parser ;
5 IN: lazy-lists
6
7 : stack-effect-in ( quot word -- n )
8   stack-effect dup [ 
9     nip effect-in length 
10   ] [ 
11     drop infer effect-in length nip
12   ] if ;
13
14 : make-lazy-quot ( word quot -- quot )
15   [
16     dup , swap stack-effect-in [ \ curry , ] times \ <promise> , 
17   ] [ ] make ;
18
19 : LAZY: ( -- object object object )
20   CREATE dup reset-generic [ dupd make-lazy-quot define-compound ] f ; parsing