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


T will support the following feature: if the second argument to ADD (i.e. +)
is a list consisting of a single number, then ADD will multiply its first
argument by that number, and return the result.

But seriously... I agree with Riesbeck that substring-from-end is very
useful, and I agree with Deutsch that there shouldn't be overloading,
and that consistent zero-originality is important.  So what's wrong with

	(SUBSTRING string start end)
	(SUBSTRING-FROM-END string start-from-end end-from-end)
with the invariant
	(SUBSTRING-FROM-END s x y)  <=>

Consistent with Lisp Machine Lisp and Common Lisp (neither of which,
much to my surprise, has documented anything corresponding to
SUBSTRING-FROM-END), and also consistent with my preference for
half-open intervals (reflected all over the place inside T already), the
"end" refers to the index of the first character not selected.

(SUBSTRING	    "Feap" 0 3) => "Fea"
(SUBSTRING-FROM-END "Feap" 0 3) =>  "eap"
(SUBSTRING	    "Feap" 1 2)	=>  "e"
(SUBSTRING-FROM-END "Feap" 1 2) =>   "a"

(If SUBSTRING-FROM-END is too long, how about GNIRTSBUS?)

There is the question of whether the substring should be shared... T is
kind of schizophrenic on the question of whether strings are to be
considered mutable objects; shared substrings are quite efficient, but
ya gotta be careful.  I need to think about this some more.  It's
especially hairy because string headers are mutable independently of
the block of characters they point into.