Data update
This commit is contained in:
parent
4d5544505c
commit
4924dd0264
3073 changed files with 55820 additions and 4408 deletions
14
Task/Y-combinator/Pluto/y-combinator.pluto
Normal file
14
Task/Y-combinator/Pluto/y-combinator.pluto
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
local function y(f)
|
||||
local g = |r| -> f(|x| -> r(r)(x))
|
||||
return g(g)
|
||||
end
|
||||
|
||||
local almost_fac = |f| -> (|x| -> x <= 1 ? 1 : x * f(x - 1))
|
||||
|
||||
local almost_fib = |f| -> (|x| -> x <= 2 ? 1 : f(x - 1) + f(x - 2))
|
||||
|
||||
local fac = y(almost_fac)
|
||||
local fib = y(almost_fib)
|
||||
|
||||
print($"fac(10) = {fac(10)}")
|
||||
print($"fib(10) = {fib(10)}")
|
||||
Loading…
Add table
Add a link
Reference in a new issue