|
|
|
|
|
by cben
1186 days ago
|
|
Sorry, i misspoke about "Church numerals". The book uses them to represent non-negative integers by lambdas but here that wasn't necessary, TypeScript allowed a simpler representation of N as a the type of an N-deep nested list. What's common to both approaches to building arithmetic is starting from zero + a "successor" function T. That approach is called "Peano arithmetic". I still recommend that post/video (and the book in general) but I have to admit there is no 1:1 correspondence to the TypeScript going on here. Still, it'll teach you some general maneuvers for bootstrapping computation out of almost nothing , qnd once you're comfortable with those, you can read things like this TypeScript post, or aphyr's original Haskell post, which bootstrap computation out of sjighly different" almost nothings" and without following the details still have a high-level idea of where it's going (like the poor interviewer in the story ;-) |
|