|
Re: Guards: msg#00132lang.haskell.cafe
On Sat, 8 Jan 2005, Lemming wrote: > Jon Cast wrote: > > > Absolutely. In Haskell's syntax, if-then-else-if interacts badly with > > do notation, and Haskell lacks a direct analogy to Lisp's cond. > > > > case () of > > () | p1 -> e1 > > | p2 -> e2 > > ... > > No problem: > > select :: a -> [(Bool, a)] -> a > select def = maybe def snd . List.find fst Alternatively: select def = fromMaybe def . lookup True |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Information given by :info (Was: Some random newbie questions): 00132, Henning Thielemann |
|---|---|
| Next by Date: | Re: Hugs vs GHC (again) was: Re: Some random newbiequestions: 00132, Ketil Malde |
| Previous by Thread: | Re: Guards (Was: Some random newbie questions)i: 00132, Lemming |
| Next by Thread: | Re: Some random newbie questions: 00132, John Hughes |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |