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

Neil Brown nccb2 at kent.ac.uk
Mon Apr 26 08:46:21 EDT 2010

Bjorn Buckwalter wrote:
> Dear all,
> Does it make good sense that 'and []' returns 'True' and 'or []'
> returns 'False'? 
It's certainly what I would expect it to do, based on several ways of 

1: If we define the function using explicit recursion:
and (x:xs) = x && and xs
Therefore and [] has to be True.  Similar logic for or.

2: My instinct is to consider "and = all (== True)", while "or = any (== 
True)".  It's even clearer to me that "all [] = True" and "any [] = 
False" (similiar to Miguel's post).



More information about the Haskell-Cafe mailing list