[Haskell-beginners] 'case of' question
Brandon Allbery
allbery.b at gmail.com
Thu Jun 23 17:29:40 CEST 2011
On Thu, Jun 23, 2011 at 11:02, Manfred Lotz <manfred.lotz at arcor.de> wrote:
> The only idea I got is:
>
> processX x
> | x `elem` [ 1, 5, 76 ] = doThis
> | x `elem` [ 112, 21 ] = doThat
> | otherwise = doOtherwise
>
That's the correct way to do it. The trick is to remember that the above is
really a "case of":
> case x of
> _ | x `elem` [1, 5, 76] -> doThis
> | x `elem
--
brandon s allbery allbery.b at gmail.com
wandering unix systems administrator (available) (412) 475-9364 vm/sms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110623/d59715b8/attachment.htm>
More information about the Beginners
mailing list