Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> It's not a number's place to know how to do looping

If we consider a number as "zero or 1 plus a number", then the "Number" class could very well be the one that knows how to execute a piece of code a number times given that representation. It's actually pretty similar to the Church encoding of numbers in the lambda calculus[1].

[1]: https://en.wikipedia.org/wiki/Church_encoding



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: