
16 Sep
2011
16 Sep
'11
5:34 p.m.
On 11-09-15 10:24 PM, Michael Litchard wrote:
Someone commented on StackOverflow that pattern matching the first element of a list was preferable to head. This makes sense intuitively. Could someone articulate the reason why this is true?
if null s then e0 else ...(head s)...(tail s)... is a clumsy way to say case s of [] -> e0 h:t -> ...h...t... The clumsy way is more familiar because it is popularized by lisp. It is the way in lisp because lisp is old.