Madhu <enometh@meer.net> wrote:
+---------------
| * Andy Chambers
| | On 7 Sep, 21:14, Marco Antoniotti <> wrote:
| |> If you use readers, this is just COMPOSE.
| |> (funcall (compose 'reader1 'reader2 ... readerN) object)
| |
| | That's cool! Its a great example of how seamlessly the functional
| | and object oriented aspects of Lisp can co-exist.
|
| Not really. Note Marco restricted the scope to readers.
+---------------
What's wrong with this, then?
(setf (writerN (funcall (compose 'reader1 ... readerN-1)) object)
new-value)
+---------------
| Tamas Papp's macro was not just for reading slots but also for
| writing them.
| |> > (setf (slot-path *c* 'a 'b) 4)
| |> > (slot-path *c* 'a 'b) ; => 4
| I'm sure one cant come up with a setf expander for funcall and compose.
+---------------
Why not? Just because FUNCALL is in the COMMON-LISP package?
Most implementations provide ways around that [e.g., wrap the
DEFSETF with a WITHOUT-PACKAGE-LOCKS or equiv.].
And at least in CMUCL, the SETF support is aleady there, were you
to define a #'(SETF FUNCALL) function:
cmu> (macroexpand
'(setf (funcall (compose 'read1 'read2 'write3) obj) newval))
(LET* ((#:G1585 (COMPOSE 'READ1 'READ2 'WRITE3)) (#:G1584 OBJ))
(MULTIPLE-VALUE-BIND (#:G1583)
NEWVAL
(FUNCALL #'(SETF FUNCALL) #:G1583 #:G1585 #:G1584)))
cmu>
-Rob
-----
Rob Warnock <rpw3@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607