I have a variable `vecsize' denoting the length of a simple vector `V';
it appears in expressions such as:
(setf vecsize 3)
Now I decide to give `V' a fill-pointer and I would like the
macro facility to replace each occurrence of `vecsize' with
(fill-pointer V)
My naive understanding of the macro facility is that I would have to
replace the above `setf' by
(setf (vecsize) 3)
which I would like not to do. Is there a way I can retain the first
form? Jonathan ······@math.ufl.edu
In article <····················@poincare.math.ufl.edu> ······@math.ufl.edu (Jonathan King) writes:
>I have a variable `vecsize' denoting the length of a simple vector `V';
>it appears in expressions such as:
>
> (setf vecsize 3)
>
>Now I decide to give `V' a fill-pointer and I would like the
>macro facility to replace each occurrence of `vecsize' with
> (fill-pointer V)
If you have a version of Common Lisp that has SYMBOL-MACROLET (introduced
in CLtL2, for support of CLOS) you could wrap all your code in:
(symbol-macrolet ((vecsize '(fill-pointer v)))
...)
If I were in this situation, though, I'd simply use a text editor to
globally replace "vecsize" with "(fill-pointer v)".
--
Barry Margolin, Thinking Machines Corp.
······@think.com
{uunet,harvard}!think!barmar