Skip to content

Instantly share code, notes, and snippets.

@geekosaur
Created January 20, 2019 20:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geekosaur/d4df269636f29bf78bb5f6b2fab8ed78 to your computer and use it in GitHub Desktop.
Save geekosaur/d4df269636f29bf78bb5f6b2fab8ed78 to your computer and use it in GitHub Desktop.
lambda calculus example - DukeDrake
(\g.\f.\x. g f (f x)) (\f.\x. x)
(\g. \f0. \x0. g f0 (f0 x0)) (\f1. \x1. x1) -- alpha rename to avoid collisions
\f0. \x0. (\f1. \x1. x1) f0 (f0 x0) -- apply parameter for g
g = (\f1. \x1. x1)
\f0. \x0. f0 x0 -- apply parameters to inner lambda and reduce
f1 = f0
x1 = f0 x0
reduction of (\f1. \x1. x1) eliminates f1 and produces x1
one can now further note that the above is essentially id, because it takes
f0 x0 and produces f0 x0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment