Pattern guards

Bulat Ziganshin bulat.ziganshin at gmail.com
Thu Sep 28 16:19:13 EDT 2006


Hello Conor,

Thursday, September 28, 2006, 10:30:46 PM, you wrote:

>   gcd x y | compare x y ->
>     LT = gcd x (y - x)
>     GT = gcd (x - y) y
>   gcd x _ = x

> or some such. I wish I could think of a better example without too much
> context, but such a thing escapes me for the moment. In general, I think
> it's good to collocate on the left as much as possible of a function's
> scrutineering. Stringing out ifs and cases makes it harder to see what's
> going on.

i like this. for me, left part of function definition is a half of
logical programming language, it only omits two-direction
pattern-matching mechanism


-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell-prime mailing list