[Haskell-cafe] Redefining Disjunction

Ilya Tsindlekht eilya497 at 013.net
Wed Jun 13 09:52:32 EDT 2007


On Wed, Jun 13, 2007 at 02:37:37PM +0100, PR Stanley wrote:
> Hi
> Can you think of a fourth way of redefining disjunct using pattern matching?
> vee :: Bool -> Bool -> Bool
> vee _ True = True
> vee True _ = True
> vee _ _ = False
> 
> ve :: Bool -> Bool -> Bool
> ve True True = True
> ve True False = True
> ve False True = True
> ve False False = False
> 
> v :: Bool -> Bool -> Bool
> v True b = True
> v b True = True
> v b False = b
> v False b = b
> 
Most obvious is
v :: Bool->Bool->Bool
v False False = False
v _ _ = True


More information about the Haskell-Cafe mailing list