
10 Nov
2014
10 Nov
'14
5:16 a.m.
On Mon, Nov 10, 2014, at 01:50 AM, Roelof Wobben wrote:
What do you experts think of the different ways ?
2 and 4 are quite similar, and both fine. 3 is not so good: guards provide weaker guarantees than patterns, and head and tail are partial functions. All three implementations have in common that they do their own recursion. It would be a good exercise to try implementing last as a fold - in other words, letting the standard library do the recursion for you. -Karl