31 Mar
2004
31 Mar
'04
12:09 a.m.
G'day all. Quoting Duncan Coutts <duncan@coutts.uklinux.net>:
Or finally, the "it's what you want most often" argument.
How about the "it's the most natural thing" argument? Pattern matching on the LHS of a function definitions looks, for all the world, like a set of rewrite rules. That's because, in some sense, they are. In this definition: f (x:xs) = 1 + f xs f [] = [] Intuitively, the first rule should only "fire" if the expression being evaluated conforms to the left-hand side. A google search for "conformality check" may also help. A potentially frightening thought is that something like the above definition would make sense in a lazy _logic_ language. Cheers, Andrew Bromage