Paste: tetha iteration problem
Author: | elasticdog |
Mode: | factor |
Date: | Tue, 28 Apr 2009 15:38:44 |
Plain Text |
: next-iteration ( n -- m )
dup even? [ 2 / ] [ 3 * 1 + ] if ;
: (chain) ( count n -- count )
dup 1 = [ drop ] [ next-iteration [ 1+ ] dip (chain) ] if ;
: chain ( n -- count )
[ 0 ] dip (chain) ;
2
Author: | elasticdog |
Mode: | factor |
Date: | Tue, 28 Apr 2009 15:54:25 |
Plain Text |
: next-iteration ( n -- m )
dup even? [ 2 / ] [ 3 * 1 + ] if ;
: chain ( n -- count )
[ dup 1 = not ] [ next-iteration dup ] produce nip length ;
2
New Annotation