Skip to content

Instantly share code, notes, and snippets.

@kawakami-o3
Last active September 10, 2018 15:58
Show Gist options
  • Save kawakami-o3/efbdeb156a12e8afdf10e59e8cd94e07 to your computer and use it in GitHub Desktop.
Save kawakami-o3/efbdeb156a12e8afdf10e59e8cd94e07 to your computer and use it in GitHub Desktop.
field
(defmacro field (slot-symbol)
(let ((slot-name (symbol-name slot-symbol)))
`(,slot-symbol
:accessor ,(intern slot-name)
:initform '()
:initarg ,(intern slot-name :keyword))))
;; not working
(defclass player ()
((field hp)
(field atk)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment