From: Nikodemus S. <tsi...@cc...> - 2004-04-25 18:50:16
|
This was noted by Kalle Olavi Niemitalo on #lisp. Current SBCL gives a warning on loops with multiple value-returning termination clauses, which as far as I can tell are legal. The actual macroexpansion looks just fine, though. From CLHS: loop [name-clause] {variable-clause}* {main-clause}* => result* main-clause::= unconditional | accumulation | conditional | termination-test | initial-final termination-test::= while form | until form | repeat form | always form | never form | thereis form So loops like (loop thereis (foo) thereis (bar)) should be quite legal, but SBCL isn't happy: CL-USER(14): (macroexpand '(loop thereis :one thereis :two)) WARNING: The LOOP clause is providing a value for the iteration; however, one was already established by a THEREIS clause. current LOOP context: THEREIS :TWO. (BLOCK NIL (LET ((#:LOOP-IT-2966 NIL)) (SB-LOOP::LOOP-BODY NIL NIL ((WHEN (SETQ #:LOOP-IT-2966 :ONE) (RETURN-FROM NIL #:LOOP-IT-2966)) (WHEN (SETQ #:LOOP-IT-2966 :TWO) (RETURN-FROM NIL #:LOOP-IT-2966))) NIL NIL))) T Have I just hit my head somewhere, and are such forms actually bogus or ill-defined? Cheers, -- Nikodemus |