[(Double,Double)] is not enough - you need to know if each end is open
or closed. Also note that you will have to use -infinity and +infinity
(-inf and +inf) to model things like the complement of (1.0,2.0).
Which brings me to a question: is there a better way to write -inf and
+inf in Haskell than "-1/0" and "1/0"?
Your data structure should be something like:
data Interval = Interval {
left :: Double,
leftopen :: Bool,
right :: Double,
rightopen :: Bool
}
data Set = Set [Interval]
If you want more efficiency, you probably want a bintree datastructure
(search Google for "quadtree" and "octree", and make the obvious
dimension shift).
--KW 8-)
--
Keith Wansbrough <[EMAIL PROTECTED]>
http://www.cl.cam.ac.uk/users/kw217/
University of Cambridge Computer Laboratory.
_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe