mirror of
https://github.com/ValKmjolnir/Nasal-Interpreter.git
synced 2026-05-24 13:35:43 +08:00
17 lines
258 B
Plaintext
17 lines
258 B
Plaintext
# Y combinator by ValKmjolnir
|
|
|
|
import("lib.nas");
|
|
|
|
var fib=func(f){
|
|
return f(f);
|
|
}(
|
|
func(f){
|
|
return func(x){
|
|
if(x<2) return x;
|
|
return f(f)(x-1)+f(f)(x-2);
|
|
}
|
|
}
|
|
);
|
|
|
|
for(var i=1;i<31;i+=1)
|
|
println(fib(i)); |