Open
Description
The encoding of lists in BLC is not a Scott encoding.
Assuming that our list data type is
data List a = Cons a (List a) | Nil
then a Scott encoding would have the same
nil = \c\n. n that BLC uses (i.e. False), but its cons would be
cons = \a\b. \c\n. c a b
which is clearly different. The cons that BLC uses actually corresponds to the stream data type
data Stream a = Cons a (Stream a)
which corresponds to an infinite list. But by some trick, BLC still makes it work for nil terminated lists as well. The trick is that the cons destructor has to accept an extra argument that is the nil deconstructor.
Metadata
Metadata
Assignees
Labels
No labels