factor/library/test/benchmark/fib.factor

12 lines
209 B
Factor
Raw Normal View History

2004-08-23 23:27:55 -04:00
IN: scratchpad
2004-10-27 21:21:31 -04:00
USE: compiler
USE: kernel
2004-08-23 23:27:55 -04:00
USE: math
USE: test
2004-10-27 21:21:31 -04:00
: fib ( n -- nth fibonacci number )
dup 1 <= [ drop 1 ] [ pred dup fib swap pred fib + ] ifte ;
2004-12-05 23:00:52 -05:00
compiled
2004-08-23 23:27:55 -04:00
[ 9227465 ] [ 34 fib ] unit-test