5 ms·
Losh doesn't use Church numerals, though, he represents numbers as lists. The fact that lists are also represented as functions is a diversion; his number three
by kenko 14y ago
Losh doesn't use Church numerals, though, he represents numbers as lists. The fact that lists are also represented as functions is a diversion; his number three doesn't represent a function f -> x -> x that returns the threefold composition of its first argument applied to its second.
- ufo 14y agoI didn't get too much into the original article but my impression is that he is using Scot encoding (essentially a 1-to1 translation of pattern matching) instead of church encoding (somethign equivalent to folds). Scott encoding doesn't get much publicity but its perfectly valid and much more intuitive, IMO.
- tome 14y agoAlso this encoding is cool: http://okmij.org/ftp/tagless-final/course/Boehm-Berarducci.html http://okmij.org/ftp/tagless-final/course/Boehm-Berarducci.h...
- tome 14y agoThere must be some confusion here. For "the threefold composition of its first argument applied to its second" the type should be "(x -> x) -> x -> x".
- kenko 14y agoRight, I was (stupidly, it was early!) just using "f" as a shorthand for a function type like x -> x.