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


     Was the following ever considered for Common Lisp?

     After SETF, the most logical and general generalized-variable
function (macro) to have next would clearly seem to be something

(MODIFYF function place . args)

would be approximately equivalent to

(SETF place (function place . args))

except of course for subforms of place being evaluated only once.

     (There are a couple of issues, such as
1) unless you prefer swapping the order of args in MODIFYF,
   function being evaluated before place)
2) evaluating function and going to (funcall function place . args) instead,
   thus allowing lambdas and suchlike.)

     This is reminiscent of, among other things, the op= statements
of the C language, where op includes +, -, etc.

     Many (if not all) "modify macros" would be easily defined in terms
of it.  E.g.,

(defmacro INCF (place &optional (increment 1))
  (MODIFYF + place increment))

     When called directly in user code, MODIFYF stands in approximately
the same relation to DEFINE-MODIFY-MACRO as LAMBDA-expressions stand to

Bob Sasseen