diff options
| author | El-BG-1970 <elouangros@hotmail.com> | 2022-07-29 19:51:45 +0200 |
|---|---|---|
| committer | El-BG-1970 <elouangros@hotmail.com> | 2022-07-29 19:51:45 +0200 |
| commit | 4352604d3349098317a29006b1665bc457463e66 (patch) | |
| tree | 96f2aeb4622f4e678006f32cde5e4ccbc2fe7152 /src/commodities.lisp | |
| parent | bf5a092fb649dd503b0265f9c2a67f2f45978ffb (diff) | |
| download | transacc-4352604d3349098317a29006b1665bc457463e66.tar.gz | |
solved errors that happened during tests
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)))) |
