RosettaCodeData/Task/Fibonacci-sequence/M2000-Interpreter/fibonacci-sequence-1.m2000

13 lines
255 B
Plaintext

Inventory K=0:=0,1:=1
fib=Lambda K (x as decimal)-> {
If Exist(K, x) Then =Eval(K) :Exit
Def Ret as Decimal
Ret=If(x>1->Lambda(x-1)+Lambda(x-2), x)
Append K, x:=Ret
=Ret
}
\\ maximum 139
For i=1 to 139 {
Print Fib(i)
}