Differences
This shows you the differences between two versions of the page.
pp:2023:haskell:l07-extra [2023/04/19 22:38] tpruteanu created |
pp:2023:haskell:l07-extra [2024/04/09 18:32] (current) tpruteanu [Pairs] |
||
---|---|---|---|
Line 31: | Line 31: | ||
==== Pairs ==== | ==== Pairs ==== | ||
We can also encode // data structures //. We will only look at one of the simpler ones, the **pair**. \\ | We can also encode // data structures //. We will only look at one of the simpler ones, the **pair**. \\ | ||
- | A pair encapsulates two variables together, that we can later access using $FIRST$ and $SECOND$ . \\ | + | A pair encapsulates two variables together, that we can later access using $ FIRST $ and $ SECOND $ . \\ |
\\ | \\ | ||
$ PAIR = \lambda x.\lambda y.\lambda f.f \ x \ y $ \\ | $ PAIR = \lambda x.\lambda y.\lambda f.f \ x \ y $ \\ | ||
$ FIRST = \lambda p.p \ TRUE $ \\ | $ FIRST = \lambda p.p \ TRUE $ \\ | ||
- | $ SECOND = \lambda p.p \ FALSE $ \\ | + | $ SECOND = \lambda p.p |
+ | \ FALSE $ \\ | ||
==== Natural Numbers ==== | ==== Natural Numbers ==== |