Programming Language Theory Flashcard
What
Books
Concepts
Deckpure-lambda-calculus
Question
What's special about the church encoding of numbers and lists?
Answer
Both have a base value:
Number: 0.
List: Empty list.
Both have an operation to "step" up a value that can cover the whole value universe of the type:
Number: +1.
List: cons with a value.
With this, we can encode numbers and lists as:
Number: .
stands for increment.
stands for zero.
-> A number roughly means applying increment times to zero.
List: .
stands for cons.
stands for empty list.
-> A list roughly means applying cons with a value times to the empty list.