Author: | glguy |
---|---|
Mode: | factor |
Date: | Fri, 10 Apr 2009 17:56:47 |
: fib ( x -- y ) { { 0 [ 0 ] } { 1 [ 1 ] } [ [ 1 - fib ] [ 2 - fib ] bi + ] } case ; ( scratchpad ) 10 [ fib ] map . { 0 1 1 2 3 5 8 13 21 34 }
Author: | glguy |
---|---|
Mode: | factor |
Date: | Fri, 10 Apr 2009 17:58:01 |
: fib ( x -- y ) dup 1 <= [ [ 1 - fib ] [ 2 - fib ] bi + ] unless ;