Rich Hickey a écrit :
>
> On May 13, 9:57 am, Christophe Grand <christo...@cgrand.net> wrote:
>   
>> Mark Reid a écrit :
>>
>>     
>>> In particular, it seems converting `(+ 1 2 3)` to `(+ 1 (+
>>> 2 3))` can speed things up.
>>>       
>> Rich, would you accept a patch to make all arities inlinable for basic
>> math ops?
>>
>>     
>
> What does the patch do?
>   

It would rewrite (+ 1 2 3) as (+ (+ 1 2) 3) but this implies to break 
some cases, currently we have:
user=> (+ Integer/MAX_VALUE Integer/MAX_VALUE)
java.lang.ArithmeticException: integer overflow (NO_SOURCE_FILE:0)
user=> (+ Integer/MAX_VALUE Integer/MAX_VALUE Integer/MAX_VALUE)
6442450941

with such a patch, we would have:
user=> (+ Integer/MAX_VALUE Integer/MAX_VALUE Integer/MAX_VALUE)
java.lang.ArithmeticException: integer overflow (NO_SOURCE_FILE:0)

it's a change but at least (+ a b c) and (+ (+ a b) c) would behave 
similarly.

(and to be more specific this patch would certainly introduce a private 
macro: def-left-associative-op)

-- 
Professional: http://cgrand.net/ (fr)
On Clojure: http://clj-me.blogspot.com/ (en)



--~--~---------~--~----~------------~-------~--~----~
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
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to