| Joel Uckelman on Fri, 3 Dec 2004 13:26:47 -0600 (CST) |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: [nimh-dev] More stuff |
Thus spake "Jon Stewart": > > Oh, ok. Well, it might make sense to validate but not explode sequences. > > Say I have a folder with 10k messages in it, and I do 'scan 1-10000'. I'm > > not sure that we should create an array with 10k elements at parse-time. > > Anything which needs the actual message numbers can just call > > sequence.message_numbers(), and the expansion could be done then. > > > As far as implementation goes, a generator/iterator type of function would > be a good idea. Each time you call it, the function evaluates lazily and > returns the next message item. Kind of a high-level functional technique, > so there's some overhead, but it is scalable. We could also use it, in the > future, to define infinite sequences, filtering, etc. Here's a potential problem with lazy evaluation: Suppose I have the sequence 'first:30 45 foo', where foo is a user-defined sequence. I think that the first time you want to do anything with this sequence, you'll need to expand the whole thing and sort the resulting list of message numbers. That's because 45 could show up in or after 'first:30', and anything could be in foo. -- J. _______________________________________________ nimh-dev mailing list nimh-dev@xxxxxxxxxxx http://lists.ellipsis.cx/mailman/listinfo/nimh-dev