On Sun, Aug 5, 2012 at 12:45 AM, Olaf Delgado-Friedrichs < olaf.delg...@googlemail.com> wrote:
> Hi, > > I am currently learning Clojure/ClojureScript and enjoying it a lot. Since > I have a bit of code I am planning to port that requires precise rational > arithmetic, I am particular delighted by the fact that Clojure natively > supports rational and arbitrary precision numbers. I'd also like to be able > to run parts of that code in the browser, though, which currently seems to > mean that I would have to define my own interface and implement it in a > platform-dependent way. > > So I'd like to know if there are currently any plans for adding Ratio, > BigInt and BigDecimal support to ClojureScript, or at least make it easier > for users to plug in their own code. I only had a brief glance at the > sources, but it seems to me that by providing my own implementations of the > 'emit-constant' multi-method for these types, I could make literals work. > The standard arithmetic operators, on the other hand, seem to be > implemented as macros that directly produce Javascript code. Any chance to > have an interface IArithmetic or such in the near future? > > Obviously, if no one's working on this or planning to, I'm happy to > contribute my own feeble attempts if anyone thinks they might be useful. > I'll just have to understand ClojureScript's implementation better first. > > Cheers, > Olaf > It would be nice but would require a lot of thought with respect to performance. http://dev.clojure.org/display/design/Numerics David -- 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