
10 Nov
2003
10 Nov
'03
1:43 p.m.
W liĆcie z pon, 10-11-2003, godz. 17:56, Graham Klyne pisze:
mapL2V = \s -> case s of s | matchT s -> Just True | matchF s -> Just False | otherwise -> Nothing
Why not this? mapL2V = \s -> if matchT s then Just True else if matchF s then Just False else Nothing
And a supplementary question... do the prelude or standard libraries define any function like this:
cond :: Bool -> a -> a -> a cond True a _ = a cond False _ b = b
No. But if it's fully applied, 'if cond then a else b' seems to be as clear. -- __("< Marcin Kowalczyk \__/ qrczak@knm.org.pl ^^ http://qrnik.knm.org.pl/~qrczak/