![](https://secure.gravatar.com/avatar/4aed3eb291895487e95cc2850cb92391.jpg?s=120&d=mm&r=g)
Today, Arthur Lemmens <alemmens@xs4all.nl> wrote:
I just downloaded iterate 1.0.9 from common-lisp.net and tried it with ACL 7.0 beta.
Unfortunately, I get a stack overflow error (see the backtrace below) when I do the following: [snip & paste] 6: (MACROEXPAND-1 (COND ((>= VALUE 10) NIL (COLLECT (CONS KEY (NEXT I))))) NIL) 7: (MACROEXPAND (COND ((>= VALUE 10) NIL (COLLECT (CONS KEY (NEXT I))))) NIL) 8: (WALK (COND ((>= VALUE 10) NIL (COLLECT (CONS KEY (NEXT I))))) NIL) 9: (WALK (COND ((>= VALUE 10) NIL (COLLECT (CONS KEY (NEXT I))))) NIL) 10: (WALK (COND ((>= VALUE 10) NIL (COLLECT (CONS KEY (NEXT I))))) NIL)
Strange. I get the expected result when I try it with allegro 6.2. I suspect that the COND form that appears so often in the backtrace is not macroexpanded correctly (or treated as a special form by allegro7 again - there is a comment indicating that in the "old" iterate distribution). I have a possible fix ready, but to confirm it's correct (or utterly wrong), I'll need to know which values (macroexpand (cond ((>= value 10) nil (collect (cons key (next i))))) nil) returns on your allegro 7 installation. Also, you are welcome to try the patch I suspect will fix the problem: --- orig/iterate.lisp +++ mod/iterate.lisp @@ -628,7 +628,8 @@ ;; functions; and, by personal preference, special operators ;; should be expanded before iterate clauses. - ((macro-function (car form) *env*) + ((and (macro-function (car form) *env*) + (nth-value 1 (macroexpand form *env*))) (walk (macroexpand form *env*))) ((special-form? (car form)) (walk-special-form form))
This is not critical for me (I'll just use an older version of iterate that I've been using for the last 4 years and that has no problems with your example or with my programs in general), but I thought you might want to know this.
Sorry that I don't come with a fix, but I don't have the time for debugging this right now.
No problem; your description has given me a good idea as to where the bug is. I hope you find the time to test the fix, though. (-: Thanks for the report! Cheers, -- Andreas Fuchs, <asf@boinkor.net>, asf@jabber.at, antifuchs