[prev in list] [next in list] [prev in thread] [next in thread]
List: haskell-beginners
Subject: [Haskell-beginners] Re: subset
From: Maciej Piechotka <uzytkownik2 () gmail ! com>
Date: 2010-01-29 16:13:01
Message-ID: 1264781580.5629.4.camel () picard
[Download RAW message or body]
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.
Regards
_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic