[Haskell-cafe] and [] = True; or [] = False

Richard O'Keefe ok at cs.otago.ac.nz
Mon Apr 26 19:16:16 EDT 2010


On Apr 27, 2010, at 12:15 AM, Bjorn Buckwalter wrote:

> Dear all,
>
> Does it make good sense that 'and []' returns 'True' and 'or []'
> returns 'False'?

YES!

There is no other behaviour that would make sense.

You wouldn't expect sum [] to return anything but 0, would you?

> What got me thinking about this was the apparently incorrect intuition
> that 'and xs' would imply 'or xs'.

Only if not (null xs).

See also Lisp and Scheme, where (AND) -> true, (OR) -> false,
and look up the behaviour of ∀ and ∃ in a logic book.
(∀x∈s)p(x) does NOT imply (∃x∈s)p(x) because s might be empty.
(This is where the modern ∀ and ∃ part company with Aristotelian
logic.  In syllogisms, "all unicorns are white" does not count as
true unless there is at least one unicorn.)



More information about the Haskell-Cafe mailing list