add test file

This commit is contained in:
ValKmjolnir
2021-08-01 22:34:02 +08:00
parent 4e1a3c5f2d
commit 91771297d3
5 changed files with 36 additions and 22 deletions
+18
View File
@@ -0,0 +1,18 @@
# Y combinator by ValKmjolnir
import("lib.nas");
var count=0;
var fib=func(f){
return f(f);
}(
func(f){
return func(x){
count+=1;
if(x<2) return x;
return f(f)(x-1)+f(f)(x-2);
}
}
);
for(var i=1;i<=20;i+=1)
println(fib(i));