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
   \__/       [EMAIL PROTECTED]
    ^^     http://qrnik.knm.org.pl/~qrczak/

_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to