<< Back to previous view

[CLJS-505] reduce-kv doesn't work on this dataset Created: 12/May/13  Updated: 18/Aug/13

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Minor
Reporter: Ben Burdette Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Chromium browser on kde mint



 Description   

reduce-kv seems to fail with certain datasets in clojurescript but works in clojure. plain reduce works in both. Test dataset and functions:

(def tst '{0 (0.16245458703559382 0.16299961144753652), 1 (0.17095488518209803 0.1662484375243468), 2 (0.19709700082585824 0.1876248353737042 0.18162592547515274), 3 (0.21941419798490325 0.21807914100386067 0.21533585716040135 0.21307519864852958 0.20703453840254027 0.20459935129415552), 4 (0.2254558759699653 0.22553167887455705 0.2234426184638531), 5 (0.23427611508459756 0.2325434766605363 0.22990656317710662 0.22720478209110223), 6 (0.236386202300682 0.237142940385559 0.23819488667547528 0.23768692982616965 0.23701568705350426 0.2519226069678777), 7 (0.23496439825060444 0.2366135730772095 0.2358487071572212 0.2343505595436482 0.2339754113241729 0.23574632954272087 0.2342899279492302 0.23394402094793673 0.2253325456308313 0.23115349467838542 0.23764956541775945 0.24569178483873644 0.24935940319340053), 8 (0.20547261591662125 0.20726089154784122 0.21592818189465432 0.21750737743637422), 9 (0.18799738410585773 0.195400717149256 0.19631498833296726), 10 (0.1719302696659648 0.17805792401151166 0.18237267730425885), 11 (0.1623645568284537 0.16481390708298796 0.16716904262359314), 12 (0.16156804839942243 0.16211838120784386), 13 (0.16995648347966535 0.16559349825186068), 14 (0.19176771652550495 0.17696322624338934), 15 (0.23973485828855146 0.22420582245618542 0.2145975801770993 0.20208630026741867), 16 (0.2946896009888785 0.28676176338007714 0.28325454941805994 0.2716914099321759 0.26202250017945194 0.25452401319317824 0.2458771184353157), 17 (0.33300741045445653 0.3282046117335755 0.32330639472087175 0.3191873692036449 0.31290612056170736 0.30418343504691503 0.3004101566486822), 18 (0.341869650592079 0.34431149263906713 0.3457698150448536 0.34421452862514235 0.3429726966458358 0.3388988973880783 0.33579154357727864), 19 (0.2968748091051211 0.3023852506442652 0.3121637065261914 0.31141190562184173 0.32205821745972246 0.32898706631919056 0.33322752162957553 0.3396066565159988), 20 (0.2317683974879252 0.24538548478582375 0.2645130722935203 0.27362218406430894), 21 (0.20128274621982342 0.21819083560963268), 22 (0.1732991500114435 0.1811216605973363 0.19151484878018085), 23 (0.16575238432187128)})

; this returns nil in clojurescript, returns a sorted dataset in clojure.
(defn sortpi [pi]
(reduce-kv (fn [c k v] (assoc c k (sort v))) {} pi))

(sortpi tst)

; this version works in both clojurescript and clojure:
(defn sortpi2 [pi]
(reduce (fn [c [k v]] (assoc c k (sort v))) {} pi))

(sortpi2 tst)



 Comments   
Comment by MichaƂ Marczyk [ 12/May/13 10:49 PM ]

Works for me on master. Which version of ClojureScript are you using?

Comment by David Nolen [ 18/Aug/13 5:23 PM ]

Lowering priority until we get more information.

Generated at Wed Jul 30 08:08:01 CDT 2014 using JIRA 4.4#649-r158309.