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

``Update functions'' in Scheme.



>  So SETF is NOT a function, and actually provides a set of source code
>  transformations that can be used to disassemble references to `place's and
>  reassemble them.

I never claimed that SETF was a function, just that you could achieve
much of its functionality with an ordinary Scheme procedure.


>  Common LISP's SETF won't work in this example.  SETF does a syntactic
>  transformation on its first operand.  It doesn't evaluate the first operand.
> 
>  Compiling ACT-FOOLISHLY-ON will give the error that no SETF method is defined
>  for "accessor."

This is exactly what I *DON'T* like about a "macrological" SETF - you
can't abstract over it!  If in fact we want to think about and manipulate
the abstract relationship between accessors and mutators, a text-based
model is simply not sufficient.


>    (LDB (BYTE 4 2) (AREF MY-ARRAY 0))
>        returns four bits from MY-ARRAY's first element (a number). 
>    (SETF (LDB (BYTE 4 2)) (AREF MY-ARRAY 0))
>        sets the four bits in MY-ARRAY's first element (a number).
>  
>  This is a case which can't be modeled as simply turning LDB into a call to
>  SET-LDB.  (AREF MY-ARRAY 0) may fetch a number from MY-ARRAY and pass it to
>  SET-LDB, but that won't change the number that's stored in MY-ARRAY.

This seems to be another version of Bard's "composition" example - is
it possible to get a functional SETF-like frob to work in
"higher-order" cases?  Like Bard, I'd be interested in any ideas on this
matter.

- Lyn -