The difference between Lists as pairs and Lists as recursors in the Lambda Calculus -
I think there are several ways to represent lists in Lambda calculus. I can write a list using the pair of
(T1, (T2, (T3, NIL))
which is the length of the Lambda period \ f Is equal to I FT1 (\ FT2 (\ FT3 TIL))
and more like doing
head = \ ll ( \ H \ Th)
How do lists work as recursors and how do I write them?
As the recursors the list is "natural fold".
The ctors are looking like this:
nil = \ add \ zero. Zero bracket = \ head \ tail \ Add. \ Zero.
After some optimization (body writing, beta / eta-acting everything), the word
cons (1, (2, opposition ( 3, zero)))
gets equal to
\ add \ zero As you can notice, add 2 plus (add 2 (add zeros))
List two ctor replacers (opposition -> add, zero -> zero) waiting for Has been, and becomes a fold.
Applying a (+)
and 0
will give us the amount of the list, (*)
and < Code> 1 - List product, Conflict
again and some tail
will give us the attached tail
behind the initial list.
The head session is applied such that:
head = \ l \def
If this list is empty and takes a default value for return and gives head.
Although tail is difficult to implement and it will work with o (list-length).
In short, the list of recursors has been prepared.
Comments
Post a Comment