Skip to content

Instantly share code, notes, and snippets.

@saitouena
Created September 29, 2019 08:21
Show Gist options
  • Save saitouena/bd4a4bf565355b586bd3ab9b4b35816e to your computer and use it in GitHub Desktop.
Save saitouena/bd4a4bf565355b586bd3ab9b4b35816e to your computer and use it in GitHub Desktop.
(defun show-usage-of-get-setf-expansion (expr)
(multiple-value-bind (temp-vars vals store-vars form access) (get-setf-expansion expr)
(format t "vars=~S~%" temp-vars)
(format t "forms=~S~%" vals)
(format t "var=~S~%" store-vars)
(format t "set=~S~%" form)
(format t "access=~S~%" access)))
(show-usage-of-get-setf-expansion '(incf i))
;; prints:
;; vars=(#:I591 #:G592)
;; forms=(I (+ 1 I))
;; var=(#:NEW1)
;; set=(FUNCALL #'(SETF SETQ) #:NEW1 #:I591 #:G592)
;; access=(SETQ #:I591 #:G592)
(show-usage-of-get-setf-expansion '(incf i))
;; prints:
;; vars=(#:I593 #:G594)
;; forms=(I (+ 1 I))
;; var=(#:NEW1)
;; set=(FUNCALL #'(SETF SETQ) #:NEW1 #:I593 #:G594)
;; access=(SETQ #:I593 #:G594)
;; gensym #:NEW1 appears twice. bug?
@saitouena
Copy link
Author

environment:

$ uname -a
Linux DESKTOP-ORU04L0 4.4.0-17763-Microsoft #379-Microsoft Wed Mar 06 19:16:00 PST 2019 x86_64 x86_64 x86_64 GNU/Linux
$ ros run -- --version
SBCL 1.5.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment