Created
September 5, 2013 16:32
-
-
Save qoelet/6452636 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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