Hi, 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: 1. compile (and load) package.lisp and iterate.lisp 2. evaluate (in-package iterate) 3. try out the example from the readme (iterate (generate i from 0 to 6) (for (key . value) in '((a . 2) (zero . 10) (one . 20) (d . 5))) (when (>= value 10) (collect (cons key (next i))))) 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. Regards, Arthur --------- Stack overflow (signal 1000) [Condition of type EXCL:SYNCHRONOUS-OPERATING-SYSTEM-SIGNAL] Restarts: 0: [CONTINUE] continue computation 1: [ABORT] Abort handling SLIME request. 2: [ABORT] Abort entirely from this (lisp) process. Backtrace: 0: (SWANK::DEBUG-IN-EMACS #<EXCL:SYNCHRONOUS-OPERATING-SYSTEM-SIGNAL @ #x20888ea2>) 1: ((FLET SWANK:SWANK-DEBUGGER-HOOK SWANK::DEBUG-IT)) 2: (SWANK:SWANK-DEBUGGER-HOOK #<EXCL:SYNCHRONOUS-OPERATING-SYSTEM-SIGNAL @ #x20888ea2> #<Function SWANK-DEBUGGER-HOOK>) 3: (CERROR "continue computation" EXCL:SYNCHRONOUS-OPERATING-SYSTEM-SIGNAL :FORMAT-CONTROL "Stack overflow (signal 1000)" :FORMAT-ARGUMENTS NIL) 4: (SPECIAL-OPERATOR-P :UNKNOWN) 5: (SYSTEM:FUNCTION-INFORMATION COND NIL) 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) 11: (WALK (COND ((>= VALUE 10) NIL (COLLECT (CONS KEY (NEXT I))))) NIL) 12: (WALK (COND ((>= VALUE 10) NIL (COLLECT (CONS KEY (NEXT I))))) NIL) 13: (WALK (COND ((>= VALUE 10) NIL (COLLECT (CONS KEY (NEXT I))))) NIL) 14: (WALK (COND ((>= VALUE 10) NIL (COLLECT (CONS KEY (NEXT I))))) NIL) 15: (WALK (COND ((>= VALUE 10) NIL (COLLECT (CONS KEY (NEXT I))))) NIL) 16: (WALK (COND ((>= VALUE 10) NIL (COLLECT (CONS KEY (NEXT I))))) NIL)
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
Andreas Fuchs wrote:
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).
Yes, cond seems to be treated as a special form by acl 7.0 beta: (special-operator-p 'cond) returns T. But (macro-function 'cond) also returns a macro expansion function for cond.
I'll need to know which values
(macroexpand (cond ((>= value 10) nil (collect (cons key (next i))))) nil)
returns on your allegro 7 installation.
If I wrap a quote around your cond form above (I'm pretty sure that's what you really meant), I get (COND ((>= VALUE 10) NIL (COLLECT (CONS KEY (NEXT I))))) NIL which confirms your suspicion, I suppose.
Also, you are welcome to try the patch I suspect will fix the problem:
Thanks, that solves the problem. Regards, Arthur
participants (2)
-
Andreas Fuchs
-
Arthur Lemmens