Been chasing a bug this morning which turned out to revolve around using Big.js 
for BigDecs in my re-frame app.

Big.js has a synonym for add()--plus()--which worked fine in my dev compilation 
mode of :none. For production compilation with :advanced, my reduce function 
was blowing up. 

Here's how add() and plus() are declared in Big.js:

P.add = P.plus = function (y) {....}

In :none plus() was seen as a defined method, but in :advanced it was not, so 
an "undefined" error was reported.

Once I changed to use add(), my reduce function worked as expected.

;; works in :none, fails in :advanced
(reduce (fn [a b] (.plus a b)) (js/Big "0") (map :concentration chems))

;; works in both
(reduce (fn [a b] (.add a b)) (js/Big "0") (map :concentration chems))

Curious about others thoughts on this.

Cheers,

Jamie

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to