
19 Sep
2008
19 Sep
'08
2:04 p.m.
Am Freitag, 19. September 2008 19:32 schrieb Logesh Pillay:
I want to check if all the numbers in a list A are elements of a bigger unordered list B.
Is there some way to fold /A into elem /B?
I suppose what you want is an efficient way to check if all elements of A also belong to B? I think if the type of elements belongs to Ord, your best bet, if B is large but not huge, is to sort B or build a Set from it and exploit the faster membership tests. If B is huge (or even infinite), that could require too much memory. Cheers, Daniel