On 09.06.2010, at 05:56, Andrzej wrote: >> The point here is not simply to add a literal notation, but to >> integrate complex type handling into the math functions. Bifurcating >> the math functions is a horrible idea. > > Exactly. Speaking for myself again, I use complex numbers (much) more > often than ratios (in fact, so far I only played with ratios rather > than used them) and such integration would be very useful for me.
Same here. It's indeed not a trivial job, but a useful one. > The question is, how far are we ready to go in that way? I imagine at > least two more data types that could be plugged into numeric tower: > - vectors/matrices > - symbolic expressions Neither of those are numbers in the mathematical sense. And from an implementation point of view, both matrices and symbolic expressions already have so much overhead that they don't require the same kind of optimization that number implementations usually get. > Maybe instead of hardwiring all these types, we should provide a > mechanism for overloading math operators? I guess multimethods would > be too slow and I have no experience with defrecord/... to predict > robustness of this solution. That's the way I explored in clojure.contrib.generic, using multimethods. I don't think the new protocol mechanism is a good choice, because it is limited to single dispatch. As I said a few messages ago in this thread, I do think that generic maths operations are very useful to have, and I appreciate Clojure for making it possible to implement and use them in a very nice way, but I do not think they are the way to go for the basic number tower, because of the multimethod overhead. I'd like to see an efficient number tower in clojure.core, ideallly with complex numbers added in, and a library for generic operations available as an add-on. Konrad. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en