Re: gensym with multiple-value-bind



On 17 Oct 2005 02:50:43 -0700, "Kaz Kylheku" <kkylheku@xxxxxxxxx> wrote:

> For instance in a LOOP, you can (RETURN) which breaks out the loop.
> That shadows any lexical function or macrolet named RETURN. Or, more
> precisely CL:RETURN.

I think you're not right here. First, from my understanding of
11.1.2.1.2 you can't lexically bind CL:RETURN as a function or macro
anyway in conforming programs. There are some implementations which
won't complain but in that case the lexical function isn't shadowed by
LOOP. LispWorks:

CL-USER 1 > (flet ((return (x) (print (list 'foo x))))
(loop for i below 10 when (oddp i) do (return i)))

(FOO 1)
(FOO 3)
(FOO 5)
(FOO 7)
(FOO 9)
NIL

Second, there's the LOOP /keyword/ RETURN but LOOP keywords are
recognized by name (STRING=) not by symbol identity:

CL-USER 1 > (defpackage my-package)
#<PACKAGE MY-PACKAGE>

CL-USER 2 > (loop for i below 10 when (oddp i) my-package::return i)
1

Cheers,
Edi.

--

Lisp is not dead, it just smells funny.

Real email: (replace (subseq "spamtrap@xxxxxxxxxx" 5) "edi")
.



Relevant Pages

  • Re: Re: strange anomalies when using an iteration variable twice in 1 function
    ... >for loop control variables are reused, ... If the array is defined as you described, ... >arrayOfString is not defined the way you think it is. ... aTemplates:= nil; ...
    (alt.comp.lang.borland-delphi)
  • Re: loop variable value in finally forms?
    ... because I'd have never written the loop this way. ... is nil after the list is exhausted. ... internal and single user-given variables can be identical. ... the Iterate package currently behaves differently (it ...
    (comp.lang.lisp)
  • Re: Getting a number from a string
    ... (defun read-safely-from-string (str) ... (let ((*read-eval* nil)) ... (defun read-safely-from-string (string) ...
    (comp.lang.lisp)
  • Re: LOOP blows!
    ... My understanding of the LOOP specification is that your expectation is ... Even if the FOR Y = X clause were to work by stepping a hidden integer ... and evaluating at every iteration to pull out the ... The problem with these implementations that return NIL is that they ...
    (comp.lang.lisp)
  • loop variable value in finally forms?
    ... NIL; <- in finally ... In the first loop above, the final value is that computed after ... assigned (a third time). ...
    (comp.lang.lisp)