Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
StefanKarpinski
on March 7, 2014
|
parent
|
context
|
favorite
| on:
Please reconsider the Boolean evaluation of midnig...
This is a nice clean criterion, but it's still pretty unclear to me why the zero element of a monoid should be considered falsey at all.
chrismonsanto
on March 7, 2014
[–]
Because when writing a recursive function, the zero element is generally the base case.
if x: <destructure x, recurse on subparts> else: return <something>
This applies to (natural) numbers as well--'destructuring' usually means decrementing the number.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: