3 ms·
Sure, that is an absolutely sensible design decision. But for other cases completeness is vital. Consider for instance the trivial case of the map function over
by choeger 6y ago
Sure, that is an absolutely sensible design decision. But for other cases completeness is vital. Consider for instance the trivial case of the map function over lists (constructed by :: and []), often abbreviated as * :
f * [ ] = [ ]
f * a::as = (f a)::(f * as)
Even if that is a nearly trivial case, it is easy to see that one could forget the first case, as all the interesting bits happen elsewhere. Now imagine, I would want to have a lazy reversal of lists, that I store as an alternative until I need to deconstruct it. I write that x~xs, meaning "x added to the end of xs".
Now I have to expand my map function as follows (because map does not care about ordering):
f * a~as = (f a) ~ (f * as)
If I miss that case (or method on Julia's case) my extension of the datatype is plain wrong.