
20 Sep
2007
20 Sep
'07
9:20 a.m.
I still can't remember how guards are treated in Haskell. Here is the code snippet in question: foo a | a == 1 = 6 foo a | a == 2 = 7 foo a = 8 Would Haskell fall through to the third alternative if a is not equal to 1 or 2. I know that this can be rewritten more sanely, but I just consider guard behavior. What would be the value of (foo 3)? -- vir http://vir.comtv.ru/