I suspect not. Maybe with fromAscList or fromDistinctAscList so it can know the list won't pop a smaller (here, duplicate) value on it, if it's lazy enough (I haven't checked). Lists don't record that they were generated from enumerations.
The following expressions both cause GHCI to hang:
> S.intersection (S.fromList [1,2]) (S.fromList [1..])
fromList ^CInterrupted.
> S.intersection (S.fromList [1..]) (S.fromList [1,2])
fromList ^CInterrupted.
>
Is there a smarter way to take the intersection of sets when at least one of them is small (but I don't know which one that is)?
--
Jeff Brown | Jeffrey Benjamin Brown
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
--