slice

Started by eddier, November 10, 2003, 10:02:42 AM

Previous topic - Next topic

eddier

Thanks for the new set-nth function!



It would be nice if slice had a negative offset that started from the end of the list instead of the beginning.



Example



(setq a '(1 2 3 4 5 6 7))
(slice a -3 2) => (5 6)


This is somewhat nicer than

(slice a (- (length a) 3) 2)


Eddie

Lutz

#1
>>>>

It would be nice if slice had a negative offset that started from the end of the list instead of the beginning.

>>>>



I was thinking about this too, sounds like a good idea for the next release. (Could also be done in nth and set-nth)



Lutz

eddier

#2
... and push, pop, and char.



Eddie

Lutz

#3
... and lookup, swap, collect, select



lets do them all ;), the thing is, if you (as a user) find it in one function, it is intuitive and expected to have it in all primitives, which use and index/offset spec.



I went looking through the code and I think it is doable without sacrifying (measurable) speed for the normal positive offset and with very little code, the mechanism, how to do it, is always the same.



Lutz

eddier

#4
I agree! Consistency is always best :)



Eddie