Hi, I woud like to create new specializer for my object system: (defclass shift () ((i :initarg :i :reader shift-i) (j :initarg :j :reader shift-j)) (:documentation "Couple of numbers"))
(defmethod create-shift ((i integer) (j integer)) (make-instance 'shift :i i :j j)) The problem is quite simple. I want to define a method "top-exists" that returns false if slot i is equal to zero, true otherwise. I've tried this as a special case, it works: (defmethod top-exists ((sh (eql (create-shift 0 0)))) nil) (top-exists (create-shift 0 0 )) ==> nil I know I can simply use this to solve my problems: (defmethod top-exists ((sh shift)) (> (shift-i sh) 0)) But I would like it to be smarter, something like this: (defmethod top-exists ((sh (slot-i-is-equal-to 0))) nil) Is it possible? Thanks, Francesco PS I defined the method "create-shift" for i and j integer because I dont' know how to require the type of the slots of a class. In my case I want i and j to be positive integers or zero. Is there a way to do this in defclass? :) -- Linux Registered User: #414858 P Funking Band http://www.perugiafunkingband.it http://www.myspace.com/perugiafunkingband _______________________________________________ Gardeners mailing list [email protected] http://www.lispniks.com/mailman/listinfo/gardeners
