diff options
Diffstat (limited to 'src/commodities.lisp')
| -rw-r--r-- | src/commodities.lisp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/commodities.lisp b/src/commodities.lisp index 1302a98..6f8c65d 100644 --- a/src/commodities.lisp +++ b/src/commodities.lisp @@ -2,7 +2,8 @@ (:use :cl) (:export :new-commodity :name - :price)) + :price + :commodity-eq)) (in-package :commodities) @@ -17,3 +18,12 @@ (make-instance 'commodity :name name :price price))) + +(defmethod print-object ((object commodity) stream) + (print-unreadable-object (object stream :type t) + (with-slots (name price) object + (format stream "~a worth ~a" name price)))) + +(defmethod commodity-eq ((c1 commodity) (c2 commodity)) + (and (equal (name c1) (name c2)) + (= (price c1) (price c2)))) |
