! Copyright (c) 2012 Anonymous
! See http://factorcode.org/license.txt for BSD license.
-USING: bit-arrays io kernel locals math sequences ;
+USING: bit-arrays io kernel math sequences ;
IN: rosetta-code.one-d-cellular
! http://rosettacode.org/wiki/One-dimensional_cellular_automata
index [ 1 - ] [ 1 + ] bi [ world ?nth ] bi@ bool-sum ;
: count-neighbours ( world -- neighbours )
- [ length iota ] keep [ neighbours ] curry map ;
+ [ length <iota> ] keep [ neighbours ] curry map ;
: life-law ( alive? neighbours -- alive? )
swap [ 1 = ] [ 2 = ] if ;
10 [ dup print-cellular step ] times print-cellular ;
MAIN: main-cellular
-