]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/lists/lazy/examples/examples.factor
Fixing everything for mandatory stack effects
[factor.git] / extra / lists / lazy / examples / examples.factor
index f85344651d1e153f328e88ad358c57cc2ca9c9ee..1d5bb49f358960b5ab7723b1d3210829164b7a5c 100644 (file)
@@ -5,11 +5,11 @@
 USING: lists.lazy math kernel sequences quotations ;
 IN: lists.lazy.examples
 
-: naturals 0 lfrom ;
-: positives 1 lfrom ;
-: evens 0 [ 2 + ] lfrom-by ;
-: odds 1 lfrom [ 2 mod 1 = ] lfilter ;
-: powers-of-2 1 [ 2 * ] lfrom-by ;
-: ones 1 [ ] lfrom-by ;
-: squares naturals [ dup * ] lazy-map ;
-: first-five-squares 5 squares ltake list>array ;
+: naturals ( -- list ) 0 lfrom ;
+: positives ( -- list ) 1 lfrom ;
+: evens ( -- list ) 0 [ 2 + ] lfrom-by ;
+: odds ( -- list ) 1 lfrom [ 2 mod 1 = ] lfilter ;
+: powers-of-2 ( -- list ) 1 [ 2 * ] lfrom-by ;
+: ones ( -- list ) 1 [ ] lfrom-by ;
+: squares ( -- list ) naturals [ dup * ] lazy-map ;
+: first-five-squares ( -- list ) 5 squares ltake list>array ;