It's a mathematical formalism for minimizing the number of distinct entities in minimalistic theories of numbers, and providing definitions of "number" that are as well-defined as possible, which turns out to be harder than it appears at first blush. In practice, it isn't generally directly used, except in places where proper facilities for using integers haven't yet been created (C++ templates at a certain point, some older Haskell type code before ints become promotable to the type level, etc). (And just to be clear, I'm not saying they've never been used in real code, but that it's a serious code smell to need to use them in real code. They get inefficient, fast; given that they're often showing up in type checking algorithms they can get inefficient superlinearly in their size.)
I vaguely remember that church numerals (or was it some other encoding ?) have been used to minimize conditional jumps in code. If someone is familiar with how that works, would love to hear.
Comments
Yeah, well, I wasn't precisely laughing when I saw it on my Formal Languages and Computability course...
Check Church numerals: https://en.wikipedia.org/wiki/Church_encoding
The reason I was laughing was because I could imagine it happening - know I know it's true I'm not sure how I feel about it.
It's a mathematical formalism for minimizing the number of distinct entities in minimalistic theories of numbers, and providing definitions of "number" that are as well-defined as possible, which turns out to be harder than it appears at first blush. In practice, it isn't generally directly used, except in places where proper facilities for using integers haven't yet been created (C++ templates at a certain point, some older Haskell type code before ints become promotable to the type level, etc). (And just to be clear, I'm not saying they've never been used in real code, but that it's a serious code smell to need to use them in real code. They get inefficient, fast; given that they're often showing up in type checking algorithms they can get inefficient superlinearly in their size.)
I vaguely remember that church numerals (or was it some other encoding ?) have been used to minimize conditional jumps in code. If someone is familiar with how that works, would love to hear.