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

Brian Spilsbury brian.spilsbury at gmail.com
Fri May 21 08:14:23 UTC 2010


"*predicate*, *test*, and *test-not* might be called more than once for each
*sequence*<http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_s.htm#sequence>
*element*<http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_e.htm#element>,
and their side effects can happen in any order."

The implementation is free to choose any inspection order under all
conditions.

:from-end and :count are not significant for ordering -- they just specify a
subset for inspection.

On Fri, May 21, 2010 at 6:00 AM, Juan Jose Garcia-Ripoll <
juanjose.garciaripoll at googlemail.com> wrote:

> 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
>
>
> ------------------------------------------------------------------------------
>
>
> _______________________________________________
> Ecls-list mailing list
> Ecls-list at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ecls-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20100521/33a7f50a/attachment.html>


More information about the ecl-devel mailing list