3 ms·
Your function second is no worse than head or last. I think you chose a difficult example. [a]->[a] or a->a would be simpler, if a bit boring.
by nandemo 13y ago
Your function second is no worse than head or last.
I think you chose a difficult example. [a]->[a] or a->a would be simpler, if a bit boring.
- Guvante 13y agoI dunno, I like second being a bad choice, the number of times it is useful are very few. `!! 2` is much more straightforward. In contrast `last` is impossible to do that way and `head` is part of the underlying data structure (as in it is a linked list, so has head and tail) so is a gimme.