|Re: Any chance for Ratio and BigInt support in ClojureScript?||David Nolen||8/5/12 2:38 PM|
On Sun, Aug 5, 2012 at 12:45 AM, Olaf Delgado-Friedrichs <olaf.d...@googlemail.com> wrote:
It would be nice but would require a lot of thought with respect to performance. http://dev.clojure.org/display/design/Numerics
|Re: Any chance for Ratio and BigInt support in ClojureScript?||Olaf Delgado-Friedrichs||8/5/12 7:43 PM|
Thanks for the link! I didn't know that the Closure library contained an arbitrary precision type, but should have expected it.
When you speak of performance, do you mean the extra cost of checking argument types for the arithmetic operators? I wonder if this could be addressed by introducing alternate operators +', -' and *' as in Clojure, make these support the additional numeric types and leave the existing operators alone. This is certainly something that makes sense for me to do in a library.
In order to support the BigInt and Ratio literals, would I have to modify the ClojureScript sources, or is it possible to extend emit-constant in "user space"?
|Re: Any chance for Ratio and BigInt support in ClojureScript?||David Nolen||8/11/12 11:47 AM|
On Sun, Aug 5, 2012 at 10:43 PM, Olaf Delgado-FriedrichsSorry, forgot to follow up this. I haven't put any deep thought into
it so I can offer no implementation guidance. I think it will be
pretty challenging to get full Clojure JVM numeric semantics into
ClojureScript w/o impacting performance.
It can probably be done but requires both a comprehensive design and
good implementation strategy. If someone wants to take it on ...
|Re: Any chance for Ratio and BigInt support in ClojureScript?||David Nolen||8/15/12 10:53 AM|
I have no gut feelings about implementation strategies :)
On Sunday, August 12, 2012, dspiteself wrote:
Just to get your gut feeling, do you think the implementation would involve bittwittling with the native number, using strings or using byte arrays? --
|Re: Any chance for Ratio and BigInt support in ClojureScript?||David Nolen||8/15/12 11:15 AM|
On Tuesday, August 14, 2012, dspiteself wrote:
What do you mean by "wasting your time"?
|Re: Any chance for Ratio and BigInt support in ClojureScript?||dspiteself||8/15/12 3:10 PM|
By wasting my time I mean if it is clear goog.math.integer is a bad idea it would be great if someone who knows would help a brother out and tell me. :-)I we are slowly moving a large google closure codebase into clojurescript so I have significantly more experience on the closure side.
goog.math.integer and goog.math.long apear to have about the same performance characteristics when one of our programmers tested a year and a half ago.my naive thought make the bigint cast and use the op' so people realize they are taking the performance hit.
(:require [goog.math.Integer :as gInteger]))
(m) (337) 205-2142
|Re: Any chance for Ratio and BigInt support in ClojureScript?||David Nolen||8/15/12 3:20 PM|
On Wed, Aug 15, 2012 at 6:10 PM, Tyler Tallman <dspit...@gmail.com> wrote:Send in your CA so you can contribute your thoughts here:
Then I and others can provide specific feedback. I think the best
approach would be a solution that first delivers all of Clojure's
numerics. Then some thought needs to be put into how it can be
implemented without slowing all the persistent data structures down.