View previous topic :: View next topic |
Author |
Message |
csauls
Joined: 27 Mar 2004 Posts: 278
|
Posted: Thu May 25, 2006 2:07 am Post subject: list.next(steps) |
|
|
Something that I've always considered missing from containers ([linked] lists particularly) was the ability to give .next() a number of steps to take. In other words, provide list.next(3) which would be the same as list.next.next.next. If it hits a null, it should just return null, rather than throw an exception. (Maybe I expected a null.) _________________ Chris Nicholson-Sauls |
|
Back to top |
|
|
teqdruid
Joined: 11 May 2004 Posts: 390 Location: UMD
|
Posted: Fri May 26, 2006 1:27 am Post subject: |
|
|
I assume that you're talking about container iterators...
You'd essentially like to be able to skip elements. iter.next(3) sounds like it returns a container with the next three elements in it. iter.skip(2).next or iter.advance(3) is what you want? |
|
Back to top |
|
|
csauls
Joined: 27 Mar 2004 Posts: 278
|
Posted: Fri May 26, 2006 8:59 am Post subject: |
|
|
The .advance(3) form looks good... I see what you mean about .next(n) reading like a slice -- although that could be a neat trick too. _________________ Chris Nicholson-Sauls |
|
Back to top |
|
|
|