
7 Jul
2015
7 Jul
'15
7:51 a.m.
Hi Imants, On Tue, Jul 07, 2015 at 12:46:25PM +0200, Imants Cekusins wrote:
is there a way to "freeze" outside variables into constants which can be used as "case" statement patterns?
I don't think so.
result1 x = if x == a1 then "one" else if x == a2 then "two" else "three" where a1 = 1 a2 = 2
There're several other ways to solve this: result1 1 = "one" result1 2 = "two" result1 _ = "three" Or: result1 x | x == 1 = "one" | x == 2 = "two" | _ = "three" Greetings, Daniel