Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defmacro define-accessor-alias (alias (&rest lambda-list) original)
- (let ((ll (parse-lambda-list lambda-list :ordinary)))
- `(progn
- (defun ,alias ,lambda-list (,original ,@(make-flat-argument-list ll)))
- (defun (setf ,alias) (new-value ,@lambda-list) (setf (,original ,@(make-flat-argument-list ll)) new-value)))))
- (pprint (macroexpand-1 '(define-accessor-alias kar (cons) car)))
- --> (progn (defun kar (cons) (car cons)) (defun (setf kar) (new-value cons) (setf (car cons) new-value)))
- (pprint (macroexpand-1 '(define-accessor-alias subsequence (sequence start &optional end) subseq)))
- --> (progn (defun subsequence (sequence start &optional end) (subseq sequence start end))
- (defun (setf subsequence) (new-value sequence start &optional end) (setf (subseq sequence start end) new-value)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement