[Haskell-beginners] Re: subset

Maciej Piechotka uzytkownik2 at gmail.com
Fri Jan 29 11:13:01 EST 2010

On Fri, 2010-01-29 at 07:07 +0000, Luca Ciciriello wrote:
> Hi All.
> Does exist a simple way to check if a lists xs is a subset of another
> list ys?
> Thanks in advance
> Luca.

xs `subsetOf` ys = null $ filter (not . (`elem` ys)) xs

I.e. We take all elements which are not in potential superset and if
there is none then the list is subset.


More information about the Beginners mailing list