[Ecls-list] LOOP error
Juan Jose Garcia-Ripoll
jjgarcia at users.sourceforge.net
Sat Feb 2 23:32:01 UTC 2008
On Feb 3, 2008 12:06 AM, Stelian Ionescu <sionescu at common-lisp.net> wrote:
> When compiling this function from KMRCL
>
> (defun remove-keyword (key arglist)
> (loop for sublist = arglist then rest until (null sublist)
> for (elt arg . rest) = sublist
> unless (eq key elt) append (list elt arg)))
>
> ECL complains that "Iteration in LOOP follows body code" but the way I
> interpret section 6.1.4 of the Hyperspec is that termination clauses are
> *not* considered to be body clauses, so I think that LOOP shouldn't
> signal an error here
The hyperspec is rather clear about this issue:
loop [name-clause] {variable-clause}* {main-clause}* => result*
all for statements are variable-clause, hence they cannot appear after
a main-clause (until, unless, etc)
http://www.lisp.org/HyperSpec/Body/mac_loop.html
> SBCL, CMUCL, Clisp, GCL and ABCL all accept that and only Clisp signals a
> warning about it
LOOP is an ugly beast. I just stole that code and I doubt I can fix
that. But I insist it is not a bug, but a commonly accepted practice.
Juanjo
--
Facultad de Fisicas, Universidad Complutense,
Ciudad Universitaria s/n Madrid 28040 (Spain)
http://juanjose.garciaripoll.googlepages.com
More information about the ecl-devel
mailing list