Skip to content

Instantly share code, notes, and snippets.

@qoelet
Created September 5, 2013 16:32
Show Gist options
  • Save qoelet/6452636 to your computer and use it in GitHub Desktop.
Save qoelet/6452636 to your computer and use it in GitHub Desktop.
-- consider function f, which evaluates to its argument multiply by 7
ghci> let f = (\f -> f * 7)
ghci> f 8
56
-- let's consider another function g, which evaluates the argument mod by 7
ghci> let g = (\g -> g `mod` 7)
ghci> g 70
0
-- function application in lambda calculus
-- (f g)
-- (\f.(f * 7) \g.(g `mod` 7))
-- (\(\g.(g `mod` 7)).(f * 7))
-- (\g.(g `mod` 7) * 7)
ghci> let h = (\g -> (g `mod` 7) * 7)
ghci> f (g (99))
7
ghci> h 99
7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment