by kazagistar · 9y ago · 0 comments
nil = λn.λc.n
cons = λx.λxs.λn.λc.c x (xs n c)
fold = λf.λz.λxs.xs z f
Another option is the Scott encoding, where a value is a case distinction nil = λn.λc.n
cons = λx.λxs.λn.λc.c x xs
fold = Y (λfold.λf.λz.λxs.xs z (λhead.λtail.f head (fold f z tail)))
And then there is the 3-tuple thing proposed in the article.In general, what you describe is representing an inductive type by its _eliminator_: https://www.quora.com/In-type-theory-what-is-an-eliminator-a...