Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
25
Task/Anonymous-recursion/Falcon/anonymous-recursion.falcon
Normal file
25
Task/Anonymous-recursion/Falcon/anonymous-recursion.falcon
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
function fib(x)
|
||||
if x < 0
|
||||
raise ParamError(description|"Negative argument invalid", extra|"Fibbonacci sequence is undefined for negative numbers")
|
||||
else
|
||||
return (function(y)
|
||||
if y == 0
|
||||
return 0
|
||||
elif y == 1
|
||||
return 1
|
||||
else
|
||||
return fself(y-1) + fself(y-2)
|
||||
end
|
||||
end)(x)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
try
|
||||
>fib(2)
|
||||
>fib(3)
|
||||
>fib(4)
|
||||
>fib(-1)
|
||||
catch in e
|
||||
> e
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue