Reputation: 1191
For numbers, I can specialise on an exact value within a defmethod
this works:
(defgeneric person (attribute)
(:documentation "attributes of a person"))
(defmethod person ((a number))
(let ((sum (+ a 10)))
(format t "The sum of 10 and ~a is ~a" a sum)))
(defmethod person ((a (eql 10)))
(format t "TENNNNNN!!!"))
> (person 11) ;; The sum of 10 and 11 is 21
> (person 10) ;; TENNNNN!!
How can I accomplish the same thing for a string match?
I tried eq
, equal
and string=
but I get an error that says not a valid parameter specializer name
?
Upvotes: 0
Views: 85