Douglas Katzman <dougk@...> writes:
> This function generates an inefficiency note because SUBSEQ derive-type
> yields nil.
> ; Of course I know this is (- (length ...) 2) and I wouldn't actually write
> it this way
> * (defun bar (atom)
> (declare(optimize (speed 3)))
> (length (subseq (symbol-name atom) 2)))
> (specifier-type 'simple-string) is a UNION-TYPE and so (array-type-p type)
> => NIL.
> SEQUENCE-RESULT-NTH-ARG helper is unable to deal with anything but array or
> So then LENGTH calls the static-fn instead of just accessing a slot in the
> resulting simple-string.
Right, SEQUENCE-RESULT-NTH-ARG can do better, in this case, doing
(csubtypep type (specifier-type 'vector)) and returning type on success,
but for things like copy-seq, which doesn't change the length of the
argument (i.e., a cons can't turn into NIL), it can be more clever, I'll
add this to my the list of things to do after the freeze is over.
With best regards, Stas.