From: Tomasz Wegrzanowski Date: 2006-07-28T03:16:44+09:00 Subject: Re: RLisp - Lisp naturally embedded in Ruby On 7/27/06, Daniel Martin wrote: > "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) > ) So, how would such a macro look like ? -- Tomasz Wegrzanowski [ http://t-a-w.blogspot.com/ ]