-(defmacro incf (place &optional (delta 1))
- (multiple-value-bind (dummies vals newval setter getter)
- (get-setf-expansion place)
- (let ((d (gensym)))
- `(let* (,@(mapcar #'list dummies vals)
- (,d ,delta)
- (,(car newval) (+ ,getter ,d))
- ,@(cdr newval))
- ,setter))))
-
-(defmacro decf (place &optional (delta 1))
- (multiple-value-bind (dummies vals newval setter getter)
- (get-setf-expansion place)
- (let ((d (gensym)))
- `(let* (,@(mapcar #'list dummies vals)
- (,d ,delta)
- (,(car newval) (- ,getter ,d))
- ,@(cdr newval))
- ,setter))))
-
-(defmacro push (x place)
- (multiple-value-bind (dummies vals newval setter getter)
- (get-setf-expansion place)
- (let ((g (gensym)))
- `(let* ((,g ,x)
- ,@(mapcar #'list dummies vals)
- (,(car newval) (cons ,g ,getter))
- ,@(cdr newval))
- ,setter))))
-
-(defmacro pushnew (x place &rest keys &key key test test-not)
- (declare (ignore key test test-not))
- (multiple-value-bind (dummies vals newval setter getter)
- (get-setf-expansion place)
- (let ((g (gensym))
- (v (gensym)))
- `(let* ((,g ,x)
- ,@(mapcar #'list dummies vals)
- ,@(cdr newval)
- (,v ,getter))
- (if (member ,g ,v ,@keys)
- ,v
- (let ((,(car newval) (cons ,g ,getter)))
- ,setter))))))