[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

An example of where setf does not do what I want.



    Date: 12 Sep 86 06:11:02 EDT (Fri)
    From: Bradley C. Kuszmaul <bradley@Think.COM>

    I want to do

      (setf (apply #'aref (cons my-array dims)) value)

    where MY-ARRAY, DIMS, and VALUE are bound to meaningful values

    Unfortunately, my reading of SETF says that the above won't work.
    If I had (ASET value array &rest dims) then I could to
      (apply #'aset (list* value my-array dims))
    to do what I want.

Recall that APPLY in Common Lisp allows more than two arguments,
unlike APPLY in traditional languages such as Maclisp, Zetalisp,
and Lisp 1.5.  Hence the expansion is

  (APPLY #'aset VALUE (CONS MY-ARRAY DIMS))

where aset is not a standard Common Lisp function, but we all know
what it does.