friedman@porthos.rutgers.edu (Gadi ) (11/03/88)
I am using Allegro CL 3.0.1.beta [sun4] (7/29/88 23:05) Copyright (C) 1985-1988, Franz Inc., Berkeley, CA, USA and am tring to setf array values using (apply #'aref array list)) (setq test (make-array '(2 2))) ; works (apply #'aref test '(1 1)) ; works (returns the correct element) (setf (apply #'aref test '(1 1)) 2) ; DOES NOT WORK. This should work, as described in CLtL pg 95 and 291. It also works fine using ;;; Sun Common Lisp, Development Environment 2.1.1, 24-Jun-88 ;;; ;;; Copyright (c) 1987 by Sun Microsystems, Inc. All Rights Reserved ;;; Copyright (c) 1985, 1986, 1987 by Lucid Inc., All Rights Reserved Can anyone think of a workaround. Something short of making a new list and using eval. (eval (setf (aref test 1 1) 2)) will work. (We all know how slow eval is) -- uucp: {ames, cbosgd, harvard, moss}!rutgers!aramis.rutgers.edu!friedman arpa: FRIEDMAN@ARAMIS.RUTGERS.EDU
hedrick@geneva.rutgers.edu (Charles Hedrick) (11/03/88)
Unless you really don't know the number of dimensions of your array in advance, (apply #'aref array list) sounds to me like it's going to be inefficient. It's going to be particularly hard to produce good compiled code for it. I agree that apply is better than eval, but not by that much. At any rate, the inverse of aref in Allegro CL appears to be excl::.inv-s-aref. So you can probably do (apply #'excl::.inv-s-aref newvalue array subscript-list) This will work until we get Franz to make (setf (apply #'aref ... work.