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

``Update functions'' in Scheme.



    Date: Tue, 10 May 88 22:37:46 edt
    From: lyn@BASEL.AI.MIT.EDU (Franklyn Turbak)

    >  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.

I agree.  That's one reason I'm watching this discussion so closely.  

    >    (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.

Question:  The LDB example is "one order higher" than a straight SETQ.  Are
there any examples that are more than one order higher?

- Stephen