From: Daniel Martin Date: 2006-07-28T02:29:53+09:00 Subject: Re: RLisp - Lisp naturally embedded in Ruby "Tomasz Wegrzanowski" writes: > Can we macro around it or something, so that > (set-local-variable variable value) introduces a function-local variable > without increasing indentation level each time it's being done? > > I think it's reasonable to write something like that (whatever the names > of set-local-variable operator is): > > (defun veclen (x y) > (set-local-variable x2 (* x x)) > (set-local-variable y2 (* y y)) > (set-local-variable z2 (+ x2 y2)) > (sqrt z2) > ) Well, you can't quite do that but you can easily do something like this: (defun veclen (x y) (easy-local-progn (local x2 (* x x)) (local y2 (* y y)) (local z2 (+ x2 y2)) (sqrt z2) ) ) Or: (defun-with-local veclen (x y) (local x2 (* x x)) (local y2 (* y y)) (local z2 (+ x2 y2)) (sqrt z2) ) (There may also be a way to override the standard meaning of "defun" to have it do what your "defun-with-local" macro does, but I'd recommend strongly against overriding standard parts of the language like that)