
On 10-Oct-2001, D. Tweed
On Wed, 10 Oct 2001, Mark Carroll wrote:
On 10 Oct 2001, Ketil Malde wrote: (snip)
function definitions. Perhaps one could have had a syntax like
z a = | a == 1 -> 1 | a == 2 -> 3
instead, as it'd make it more consisten with the case, but I suppose there's a reason for it being the way it is. The case statement is an (snip)
Ah, yes - it was this 'discrepancy' that was one of the sources of my confusion, as "a == 1" obviously doesn't 'equal' "1".
I think this comes about from history; in the functional languages like Miranda & Orwell that preceded Haskell an extended version of the function above would have been written
z a = 1 if a==1 = 2 if a==2 = 3 otherwise
which looks a lot like traditional mathematics and where the equals makes sense. I'm not sure why anymore but Haskell changed the `if clause after the value' to `pattern guard | before =', so I agree it now looks as if it's stating that the pattern guard is equal to the rhs.
I've heard that the company which trademarked "Miranda" also obtained
a design patent on using syntax like that in a programming language.
The enforcibility of such a design patent is IMHO legally dubious,
and the application of design patents to programming languages has
never been tested in court as far as I am aware. But nevertheless
the mere existence of such a design patent was probably a significant
disincentive to using that syntax.
--
Fergus Henderson