Re: (loop initially ... getting non-ANSI CL warning



Den Tue, 22 Jan 2008 02:46:53 -0800 skrev Mirko.Vukovic:

I am still in a bit of shock that my first loop attempt works, with one
legalistic exception.

This is my simple code to show duplicates in a list:

(defun show-duplicates (list)
(loop
initially with ref = (first list)
for entry in (rest list) do
(if (equal ref entry)
(print entry))
(setf ref entry)))

Using clisp on windows+cygwin+emacs+slime, I get the following warning
upon compilation:
WARNING: LOOP: missing forms after INITIALLY: permitted by CLtL2,
forbidden by
ANSI CL.
The code seems to work:
[snip]
I could not find examples that would show me the problem with my
"initially" form.

Just remove it. WITH already establishes bindings. Besides, have you
tried ITERATE? Well-documented, extensible and much more lispish in
syntax.

Cheers,
Maciej
.



Relevant Pages