Email list hosting service & mailing list manager


negative indices to take/drop Doug Evans 04 Jan 1999 20:16 UTC

>From: "Harvey J. Stein" <xxxxxx@bfr.co.il>
>Date: Mon, 4 Jan 1999 12:35:21 +0200
>
>III. take & drop.
>
>Again, I agree with Sergei that it is strange to count from the end
>when the index argument is negative.

Depends on how akin you are to APL. :-)

>Does anyone have any examples
>where this would be much more convenient than having 2 sets of fcns -
>one for counting from the beginning & one for counting from the end?
>I don't see any continuity reasons for thinking that (take l -1)
>should be a list containing the last element of l.

One comment I have is that the document doesn't specify what happens
with over-take or over-drop (> (abs n) (length l)).