Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
12
Task/Anonymous-recursion/Factor/anonymous-recursion.factor
Normal file
12
Task/Anonymous-recursion/Factor/anonymous-recursion.factor
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
USING: kernel math ;
|
||||
IN: rosettacode.fibonacci.ar
|
||||
|
||||
: fib ( n -- m )
|
||||
dup 0 < [ "fib of negative" throw ] when
|
||||
[
|
||||
! If n < 2, then drop q, else find q(n - 1) + q(n - 2).
|
||||
[ dup 2 < ] dip swap [ drop ] [
|
||||
[ [ 1 - ] dip dup call ]
|
||||
[ [ 2 - ] dip dup call ] 2bi +
|
||||
] if
|
||||
] dup call( n q -- m ) ;
|
||||
Loading…
Add table
Add a link
Reference in a new issue