[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: common-lisp@SAIL.STANFORD.EDU
- Subject: MODIFYF
- From: VERACSD@A.ISI.EDU
- Date: Sat, 27 Jun 1987 02:10:00 -0000
- Cc: veracsd@A.ISI.EDU
- Sender: VERACSD@A.ISI.EDU
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
I call MODIFYF.
(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