From: Christian Neukirchen Date: 2006-07-27T21:24:51+09:00 Subject: Re: RLisp - Lisp naturally embedded in Ruby "Tomasz Wegrzanowski" writes: > On 7/25/06, Christian Neukirchen wrote: >> "Tomasz Wegrzanowski" writes: >> >> > On 7/25/06, Christian Neukirchen wrote: >> >> Personally, I'd prefer setf. >> > >> > Is setf used like that in any Lisp ? >> >> Does Common Lisp count? :) > > Yeah, but setf changes variables in outside scope. > (setf a 2) > (defun foo () > (setf a 3) > a > ) > (foo) ; -> 3 > a ; -> 3 No, that's just because a is global here. Shadow it by a local variable: (defun foo () (let (a) (setf a 3) a)) a ; => 2 (foo) ; => 3 a ; => 2 > I think it would be a huge win if variables were local to > the nearest lambda (or equivalent) by default, just like in Ruby. That's why one uses LET for local variables. ;-) -- Christian Neukirchen http://chneukirchen.org