RosettaCodeData/Task/Y-combinator/CoffeeScript/y-combinator-3.coffee

3 lines
119 B
CoffeeScript
Raw Permalink Normal View History

2013-10-27 22:24:23 +00:00
fac = Y( (f) -> (n) -> if n > 1 then n * f(n-1) else 1 )
fib = Y( (f) -> (n) -> if n > 1 then f(n-1) + f(n-2) else n )