Paste: Naive Fibonacci function
Author: | pozorvlak |
Mode: | factor |
Date: | Thu, 7 May 2009 11:11:31 |
Plain Text |
: fib ( n -- f ) dup 1 <=
[ drop 1 ]
[ [ 1 - fib ] [ 2 - fib ] bi + ] if ;
Author: | prunedtree |
Mode: | factor |
Date: | Thu, 7 May 2009 11:32:54 |
Plain Text |
: fib ( n -- n' ) dup 2 > [ { 1 2 } [ - fib ] with map sum ] when ;
Author: | prunedtree |
Mode: | factor |
Date: | Thu, 7 May 2009 11:35:31 |
Plain Text |
: fib ( n -- n' ) 1 1 rot [ tuck + ] times drop ;
Author: | pruned |
Mode: | factor |
Date: | Thu, 7 May 2009 12:14:26 |
Plain Text |
: fib ( n -- n' ) { { 1 1 } { 1 0 } } swap m^n first second ;
: m^n ( m n -- n ) make-bits over first length identity-matrix [ [ dupd m. ] when [ dup m. ] dip ] reduce nip ;
Author: | elasticdog |
Mode: | factor |
Date: | Thu, 7 May 2009 14:55:53 |
Plain Text |
MEMO: fib ( m -- n )
dup 1 > [ [ 1 - fib ] [ 2 - fib ] bi + ] when ;
New Annotation