Re: compiler bug, maybe
Thank you Sean, dans le mille!
From the Backquote entry in the hyperspec:
An implementation is free to interpret... The constructed copy of
the template might or might not share list structure with the template itself.
Francis
At 1/04/2005 11:39, Sean Ross wrote:
>Francis Leboutte <f.leboutte@algo.be> writes:
>
> > Hello,
> >
> > LWw (last version) can't evaluate or compile the following test
> > function (seems to loop forever). It works with ACL. Maybe a bug?
> >
> > (defmacro push-string (in-string out-string)
> > `(progn ,@(mapcan (lambda (char)
> > `((setf (char ,out-string j) ,char)
> > (incf j)))
> > (coerce in-string 'list))))
> >
> >
> > (defun test ()
> > (let ((new-string "xyc")
> > (j 0))
> > (push-string "ab" new-string)
> > new-string))
>
>Yikes, this does the same thing on SBCL and LWL.
>It seems to be caused by the destructive modification of
>the backquoted form in the lambda body.
>
>Replacing the current lambda form with
>
>(lambda (char)
> (list `(setf (char ,outstring j) ,char)
> `(incf j)))
>
>seems to work fine.
>
>Regards,
> Sean.
>
>--
>"My doctor says that I have a malformed public-duty gland and a
> natural deficiency in moral fibre," he muttered to himself, "and
> that I am therefore excused from saving Universes."
> - Life, the Universe, and Everything Douglas Adams.
>
>
>______________________________________________________________________
>This email has been scanned by the MessageLabs Email Security System.
>For more information please visit http://www.messagelabs.com/email
>______________________________________________________________________
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________