Re: type specifier '(simple-vector n) in defmethod
Michał "phoe" Herda <[email protected]> Tue, 02 Jan 2024 12:17:21 +0100
| Newsgroups | gmane.lisp.openmcl.devel |
|---|---|
| Message-ID | <[email protected]> |
No, standard CLOS dispatch happens only on classes. Have you tried https://github.com/digikar99/polymorphic-functions ? W dniu 2024-01-02 12:14, Taoufik Dachraoui napisał(a): > Hi > > I am trying to use '(simple-vector n) as type specifier in defmethod > but it is not possible, is there another way? > > (typep #(1 2 3 4) '(simple-vector 4)) > > (defmethod mul ((n fixnum) (m1 (simple-vector n)) (m2 (simple-vector > n))) > (let ((r (make-array (list n)))) > (dotimes (i n) > (setf (svref r i) (* (svref m1 i) (svref m2 i)))) > r)) > Kind regards > > Taoufik Dachraoui