Sunil S Nandihalli <[email protected]> writes: > thanks Alex for your response . I tried it ... It compiled fine .. but the > double dispatch does not seem to work correctly .. > > It some how reverses the arguments and then dispatches to the correct > function for the reversed arguments and the function works properly > .. > i.e. > when I do (- (Complex. 1 3) 3) .. I would expect (Complex. -2 3) but I get > (Complex. 2 -3) > which is what I would expect to get when I do (- 3 (Complex. 1 3)) . > > I am trying to make it work right .. but I thought some of you may better > able to fix it.
Oh right. Just swap type1 and type2 in extend-double. Looks like the implementation of (subtract Number Complex) had a bug too, it didn't negate the imaginary component. Updated the gist: https://gist.github.com/755758 -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en
