Re: [Haskell-cafe] Redefining Disjunction

2007-06-13 Thread Chris Mears
PR Stanley <[EMAIL PROTECTED]> writes:

> 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

In the same spirit:

f False False = False
f _ _ = True
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


RE: [Haskell-cafe] Redefining Disjunction

2007-06-13 Thread Bayley, Alistair
> [mailto:[EMAIL PROTECTED] On Behalf Of PR Stanley
> 
> 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

How many ways do you want? I think this is correct, and is only strict
in the first arg:

v :: Bool -> Bool -> Bool
v True _ = True
v False b = b

Alistair
*
Confidentiality Note: The information contained in this message,
and any attachments, may contain confidential and/or privileged
material. It is intended solely for the person(s) or entity to
which it is addressed. Any review, retransmission, dissemination,
or taking of any action in reliance upon this information by
persons or entities other than the intended recipient(s) is
prohibited. If you received this in error, please contact the
sender and delete the material from any computer.
*
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Redefining Disjunction

2007-06-13 Thread Ilya Tsindlekht
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
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe