1 ! Rewritten by Matthew Willis, July 2006
2 ! Copyright (C) 2004 Chris Double.
3 ! See http://factorcode.org/license.txt for BSD license.
5 USING: lists.lazy math kernel sequences quotations ;
6 IN: lists.lazy.examples
10 : evens 0 [ 2 + ] lfrom-by ;
11 : odds 1 lfrom [ 2 mod 1 = ] lfilter ;
12 : powers-of-2 1 [ 2 * ] lfrom-by ;
13 : ones 1 [ ] lfrom-by ;
14 : squares naturals [ dup * ] lazy-map ;
15 : first-five-squares 5 squares ltake list>array ;