Here are a few results of applying 'foldl' to this particular equality operator. I do not understand them - I thought that each line should return true, since "False == False == False ..." is true regardless of the length of the list. I am fairly new to Haskell.
Prelude> foldl (==) False [False]
True
Prelude> foldl (==) False [False,False,False]
True
Prelude> foldl (==) False [False,False,False,False]
False
Prelude> foldl (==) False [False,False,False,False,False]
True
Prelude> foldl (==) False [False,False,False,False,False,False]
False
I found these results when trying to write a function that tests whether a list of functions give the same result when applied to a common argument (returning a Boolean).
==is a binary operator. When you writeFalse == False == False, you’re really writing(False == False) == False, which isTrue == False. Perhaps now you can understand what’s happening. - Alexis KingFalse == False == ... == Falseis, indeed, equivalent to(False == False) and (False == False) and ... and (False == False). - chepnerFalse, useall (==False) [False, False,False]. - Karl Bielefeldt