i can't understand lambda calculus at all
Submitted by flabberghaster in just_post
Specifically i can't understand how the Y combinator works, how do you make a recursive function, all the explanations i have read make no sense.
Submitted by flabberghaster in just_post
Specifically i can't understand how the Y combinator works, how do you make a recursive function, all the explanations i have read make no sense.
and if you actually want to try it here's a spagehti i found on rosetta code for the y combinator
y_combinator = fn f ->
(fn x ->
x.(x)
end).(fn y ->
f.(fn z ->
y.(y).(z)
end)
end)
end
i went back and actually did try it and it works using this definition
y combinator is an incubator for demons that will kill us all
i hate that they took the name of a cool math thing. math is for cool people not for bloodthirsty capitalist nerds
I just checked the Wiki (I have never studied lambda calculus), can you beta reduce Y g = ...stuff... by hand?
man i can barely understand regular calculus lol
musou wrote (edited )
it doesn't let you write a recursive function the normal way, instead you write a function that takes a function as input (so you can introudce a stand-in name for the recursive call) and returns the function you want to write recursively except you call the input function in place of the recursive step. then you pass that through the y combinator to get it to work. here's an untested example in elixir because it's what i think in