One idea that might not occur to a newcomer is to represent each set by a function with a type like (Double -> Bool), implementing the set membership operation. This makes set-theoretic operations easy: the complement of s is not.s (though watch out for NaNs!), the union of s and t is (\x -> s x || t x), and so on. Open, closed, and half-open intervals are easy too. The big limitation of this representation is that there's no way to inspect a set except by testing particular values for membership, but depending on your application this may not be a problem.

-- Ben

_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to