lisp-practice/test.lisp

27 lines
797 B
Common Lisp
Raw Permalink Normal View History

2020-10-09 21:13:59 -04:00
(let ((equipment '(armor (head
(dragon-helmet)
legs (empty)
arms (empty))
weapon (left
(wooden-shield)
right (empty))
ring (left
(empty)
right (empty)))))
(defun get-armor()
(getf equipment 'armor))
(defun get-helmet()
(getf (get-armor) 'head))
(defun get-legs()
(getf (get-armor) 'legs))
(defun get-arms()
(getf(get-armor) 'legs))
(defun change-helmet (helmet)
"Useage: (change-helmet 'god-helmet"
(setf (car (get-helmet)) helmet))
(defun change-legs (legs)
(setf (car (get-legs)) legs))
(defun change-arms (arms)
(setf (car (get-arms)) arms)))