| Joel Uckelman on Fri, 3 Dec 2004 15:06:26 -0600 (CST) |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: [nimh-dev] More stuff |
Thus spake "Jon Stewart": > > MH treats sequences like sets. E.g. 'scan 2 1 1' will show you the scan > > for 1, followed by the scan for 2. I like it that way. I wish it were > > also a way to apply set-theoretic operations other than union and negation, > > though. Say I want to list all messages in foo and bar, e.g., I should be > > able to 'scan foo&bar'. > > > Hmm. Then I guess we will need to calculate the sequence upfront. In that > case, it's probably best to have a sorted list of range tuples, [beg, > end). Constructing the list isn't too hard. You throw the first specified > range in the list and, if there are any others, you go through the list > for each one (it's a quadratic algorithm) and either insert the range in > its rightful place -- if it's disjoint with existing ranges -- or expand > the existing ranges if there are overlaps. > > CPU and memory usage are constant in the common case of only one specified > range. If someone is dumb enough to specify such a complicated listing > that the quadratic nature gets to be inhibiting, well, that's a good > thing. Software should stand up for itself when abused. A quadratic algorithm isn't bad when n is small. I can't remember the last time that I gave a sequence containing even two overlaping ranges. _______________________________________________ nimh-dev mailing list nimh-dev@xxxxxxxxxxx http://lists.ellipsis.cx/mailman/listinfo/nimh-dev