Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

## [Sbcl-devel] LOOP expansion question

 [Sbcl-devel] LOOP expansion question From: heow - 2010-03-31 21:15:56 ```Anybody know why this works in "every lisp but SBCL": (loop for i do (print i) until (> i 3)) It looks legit, but won't even macroexpand. - h ```

 [Sbcl-devel] LOOP expansion question From: heow - 2010-03-31 21:15:56 ```Anybody know why this works in "every lisp but SBCL": (loop for i do (print i) until (> i 3)) It looks legit, but won't even macroexpand. - h ```
 Re: [Sbcl-devel] LOOP expansion question From: Christophe Rhodes - 2010-03-31 21:32:07 ```heow writes: > Anybody know why this works in "every lisp but SBCL": > > (loop for i do (print i) until (> i 3)) > > It looks legit, Does it? I couldn't convince myself that it was legal according to the EBNF in ;... could you explain what you think it means? Also, 6.1.2.1.1 says that for-as-arithmetic must use at least one of the prepositions -- and you've used none. > but won't even macroexpand. Best, Christophe ```
 Re: [Sbcl-devel] LOOP expansion question From: Sidney Markowitz - 2010-03-31 21:33:42 ```heow wrote, On 1/04/10 9:49 AM: > Anybody know why this works in "every lisp but SBCL": > > (loop for i do (print i) until (> i 3)) According to the hyperspec there is no version of the for clause that lets you specify the variable by itself with like that, with no from, upfrom, across, etc. You need to do something like (loop for i upfrom 0 do (print i) until (> i 3)) ```
 Re: [Sbcl-devel] LOOP expansion question From: Sidney Markowitz - 2010-03-31 22:14:11 ```heow wrote, On 1/04/10 9:49 AM: > Anybody know why this works in "every lisp but SBCL": Counterexamples: ccl: Welcome to Clozure Common Lisp Version 1.4-r13119 (DarwinX8632)! ? (loop for i 0 do (print i) until (> i 3)) > Error: 0 found where a LOOP keyword or LOOP type keyword expected. > Current LOOP context: FOR I 0. > While executing: ANSI-LOOP::LOOP-ERROR, in process listener(1). > Type :POP to abort, :R for a list of available restarts. > Type :? for other options. 1 > Lispworks 5.1.1: CL-USER 1 > (loop for i 0 do (print i) until (> i 3)) Error: LOOP keyword expected in (... 0 DO (PRINT I) UNTIL (> I 3)). 1 (abort) Return to level 0. 2 Return to top loop level 0. Type :b for backtrace, :c
 Re: [Sbcl-devel] LOOP expansion question From: heow - 2010-03-31 22:53:35 ```Well hock, not being legal settles it. :-) I'd tried LispWorks 5.1 and CLISP, both on Linux, this is from LispWorks: CL-USER 1 > (loop for i do (print i) until (> i 3)) 0 1 2 3 4 NIL CL-USER 2 > (macroexpand-1 '(loop for i do (print i) until (> i 3))) (BLOCK NIL (MACROLET ((LOOP-FINISH NIL (QUOTE (GO #:|end-loop-752|)))) (LET ((#:|by-756| 1) (I 0)) (TAGBODY (PROGN) #:|begin-loop-751| (PRINT I) (WHEN (> I 3) (GO #:|end-loop-752|)) (PROGN (LET ((#:|temp-757| (+ I #:|by-756|))) (SETQ I #:|temp-757|))) (GO #:|begin-loop-751|) #:|end-loop-752| (RETURN-FROM NIL NIL))))) - h Sidney Markowitz wrote: > heow wrote, On 1/04/10 9:49 AM: > >> Anybody know why this works in "every lisp but SBCL": >> > > Counterexamples: > > ccl: > > Welcome to Clozure Common Lisp Version 1.4-r13119 (DarwinX8632)! > ? (loop for i 0 do (print i) until (> i 3)) > >> Error: 0 found where a LOOP keyword or LOOP type keyword expected. >> Current LOOP context: FOR I 0. >> While executing: ANSI-LOOP::LOOP-ERROR, in process listener(1). >> Type :POP to abort, :R for a list of available restarts. >> Type :? for other options. >> > 1 > > > Lispworks 5.1.1: > > CL-USER 1 > (loop for i 0 do (print i) until (> i 3)) > > Error: LOOP keyword expected in (... 0 DO (PRINT I) UNTIL (> I 3)). > 1 (abort) Return to level 0. > 2 Return to top loop level 0. > > Type :b for backtrace, :c
 Re: [Sbcl-devel] LOOP expansion question From: Sidney Markowitz - 2010-03-31 22:29:42 ```heow wrote, On 1/04/10 9:49 AM: > Anybody know why this works in "every lisp but SBCL": > > (loop for i do (print i) until (> i 3)) Sorry for the copy/paste error in my previous attempt at counterexamples. Testing with the above form, Lispworks 5.1.1 on my Macbook does evaluate without error, acting as if it said upfrom 0. There is still an error when trying it in Clozure (ccl) Welcome to Clozure Common Lisp Version 1.4-r13119 (DarwinX8632)! ? (loop for i do (print i) until (> i 3)) > Error: DO is an unknown keyword in FOR or AS clause in LOOP. > Current LOOP context: FOR I DO (PRINT I) UNTIL. > While executing: ANSI-LOOP::LOOP-ERROR, in process listener(1). > Type :POP to abort, :R for a list of available restarts. > Type :? for other options. 1 > ```
 Re: [Sbcl-devel] LOOP expansion question From: heow - 2010-03-31 22:55:14 ```It also breaks in ABCL, probably because [I think] they use SBCL's macro. - h Sidney Markowitz wrote: > heow wrote, On 1/04/10 9:49 AM: > >> Anybody know why this works in "every lisp but SBCL": >> >> (loop for i do (print i) until (> i 3)) >> > > Sorry for the copy/paste error in my previous attempt at counterexamples. > > Testing with the above form, Lispworks 5.1.1 on my Macbook does evaluate > without error, acting as if it said upfrom 0. There is still an error > when trying it in Clozure (ccl) > > Welcome to Clozure Common Lisp Version 1.4-r13119 (DarwinX8632)! > ? (loop for i do (print i) until (> i 3)) > >> Error: DO is an unknown keyword in FOR or AS clause in LOOP. >> Current LOOP context: FOR I DO (PRINT I) UNTIL. >> While executing: ANSI-LOOP::LOOP-ERROR, in process listener(1). >> Type :POP to abort, :R for a list of available restarts. >> Type :? for other options. >> > 1 > > > ```