Given the distinction between lists and sets, you might also consider

Prelude Data.Set Data.List> [] `isInfixOf` [1,2,3]
True
Prelude Data.Set Data.List> (fromList []) `isSubsetOf` (fromList [1,2,3])
True 

Of course `isInfixOf` is in general more restrictive than `isSubsetOf`, in the sense that the infix relationship depends on ordering, which the subset relationship does not.

Hope that helps,

-jn-



On Wed, Mar 25, 2015 at 8:55 AM, Shishir Srivastava <shishir.srivastava@gmail.com> wrote:
Hi, 

Can someone please explain why this results in error - 

[] `elem` [1,2,3]

Shouldn't the empty set by definition be the element of all sets including a non-empty set ?

I am assuming 'Lists' are different from 'Sets' in Haskell, if yes, is there a separate module for dealing/working with sets ?

Thanks,
Shishir Srivastava


_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners




--
Beauty of style and harmony and grace and good rhythm depend on simplicity. - Plato