Jump to content

Y combinator: Difference between revisions

(→‎{{header|Q}}: add Fibonacci function)
Line 3,751:
}
Checkit
// same but more compact
Module Checkit {
fac=lambda (f)->{=lambda f (x)->f(f,x)}(lambda (m, n)->{=if(n<2->1,n*m(m, n-1))})
fib=lambda (f)->{=lambda f (x)->f(f,x)}(lambda (m, n)->{=if(n<=1->n,m(m, n-1)+m(m, n-2))})
For i=1 to 10
Print fib(i), fac(i)
Next i
}
Checkit
 
Module CheckRecursion {
fac=lambda (n) -> {
404

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.