[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: string functions

(SUBSTRING string m n) means m THROUGH N, and -1 means the right end.
I agree that too many features spoil the broth, especially of the "T
means this, NIL means this, and no argument at all means this" variety.

What I want is a convenient way to reference the right end.  When I
compare both convenience AND READABILITY of

    (SUBSTRING string 0 (- (STRING-LENGTH string) 2))


    (SUBSTRING string 1 -2)

I know where my vote goes.  With 1-based indexing, I can read the second
form as "from first to second-last".  I have no easy way to read the first
0-based form.  Perhaps there's a totally different way to look at this,
such as


or something.