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.

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to