Show HN: Church encoding in Elixir
Isn't it beautiful?
defmodule Church do
def true_(f, _) do
f
end
def false_(_ ,g) do
g
end
def if_(x, then_, else_) do
x.(then_, else_)
end
end
IO.puts Church.if_(&Church.true_/2, 4, 2)
IO.puts Church.if_(&Church.false_/2, 4, 2)
0 comments
[ 3.5 ms ] story [ 9.3 ms ] threadNo comments yet.