Author: | elasticdog |
---|---|
Mode: | factor |
Date: | Tue, 28 Apr 2009 15:38:44 |
: 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) ; ! (scratchpad) 4 chain . 2
Author: | elasticdog |
---|---|
Mode: | factor |
Date: | Tue, 28 Apr 2009 15:54:25 |
: next-iteration ( n -- m ) dup even? [ 2 / ] [ 3 * 1 + ] if ; : chain ( n -- count ) [ dup 1 = not ] [ next-iteration dup ] produce nip length ; ! ( scratchpad ) 4 chain . 2