Browse thread
Set union/inter/diff efficiency
-
Jon Harrop
- Diego Olivier Fernandez Pons
-
james woodyatt
-
james woodyatt
- james woodyatt
-
james woodyatt
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | james woodyatt <jhw@w...> |
| Subject: | Re: [Caml-list] Set union/inter/diff efficiency |
On 27 Jul 2005, at 10:00, james woodyatt wrote: > On 27 Jul 2005, at 09:04, james woodyatt wrote: >> >> Load into a queue. >> While queue is not empty, > > Okay, a queue is the wrong idea. The right idea would be somewhat > trickier loop over the sequence of element sequences to catch the > union elements in the right order. And I neglected to mention that > you'd need to build the result set with [Cf_set.of_incr_list]. Dammit. I can't do anything right this morning. I'm pretty sure you can get what you want with a combination of different things in my Cf library, e.g. Cf_seq, Cf_heap and Cf_set. For union: Convert the sets into a heap of element sequences. Loop through the heap to unify into a single element sequence. Build a new set from the unified element sequence. For difference and intersection: I'd have to think about it some more. -- j h woodyatt <jhw@wetware.com> markets are only free to the people who own them.