In article <···············@engc.bu.edu>, David Bakhash <·····@bu.edu> wrote:
> hey,
>
> I noticed that there are functions that just don't have mutator
> functions that you can call directly (i.e. without setf). I am not
> sure that this is a problem (yet), but here goes...
>
> suppose you have the following code:
>
> (setq a (make-array '(10 10 10)))
> (setq lst '(2 4)) ; the value of `lst' was somehow set at runtime...
> (loop for i below 10
> do
> (setf `(aref a ,@lst ,i) whatever)) ; #### this won't work!!! ####
>
> Now, my question is really, how the heck to you do this? If this
> cannot be fixed without knowing the actual accessor function, and how
> it takes its arguments, then this sucks, and I would feel
> unsatisfied. Can someone please reassure me that there's a way around
> this? (oh, and hopefully one that's portable too)
Something like this?
(loop for i below 10
do (setf (apply #'aref a (append lst (list i))) pi))
--
http://www.lavielle.com/~joswig