3 ms·
I think the point is, recursive solutions like the above are often easier to read. In fact the example above looks tail-recursive to me (at least if you add in
by abstractbill 18y ago
I think the point is, recursive solutions like the above are often easier to read.
In fact the example above looks tail-recursive to me (at least if you add in an accumulator parameter). That means a good compiler will make it efficient.
- vegai 18y agoNote though that using ++ like that builds lots and lots of intermediate lists.