[Ecls-list] Feedback needed: :FROM-END

Juan Jose Garcia-Ripoll juanjose.garciaripoll at googlemail.com
Thu May 20 21:00:44 UTC 2010


Take the code below in the ANSI test suite. I interpret the specification as
follows: if :FROM-END is supplied but :COUNT is not, the implementation is
free to choose a different inspection order, in particular because it might
be more efficient!

"Supplying a from-end of true matters only when the count is provided
(and non-nil); in that case, only the rightmost count elements satisfying
the test are removed (instead of the leftmost)."
http://www.lispworks.com/documentation/HyperSpec/Body/f_sbs_s.htm

I am asking for feedback because I am rewriting all sequence functions to
make them more efficient and way more readable.

Juanjo

(LET* ((ORIG #(1 2 3 4 5 6 7 8 9))
             (X (COPY-SEQ ORIG))
             (C 5)
             (RESULT
              (NSUBSTITUTE 'X
                           9
                           X
                           :TEST-NOT
                           #'(LAMBDA (A B) (INCF C -2) (/= (+ B C) A))
                           :FROM-END
                           T)))
        RESULT)

-- 
Instituto de Física Fundamental, CSIC
c/ Serrano, 113b, Madrid 28006 (Spain)
http://tream.dreamhosters.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20100520/5aa93135/attachment.html>


More information about the ecl-devel mailing list