RosettaCodeData/Task/Anonymous-recursion/Maple/anonymous-recursion-1.maple

14 lines
397 B
Plaintext

Fib := proc( n :: nonnegint )
proc( k )
option remember; # automatically memoise
if k = 0 then
0
elif k = 1 then
1
else
# Recurse, anonymously
thisproc( k - 1 ) + thisproc( k - 2 )
end
end( n )
end proc: