cgrand / xforms

Extra transducers and reducing fns for Clojure(script)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

x/sort-by bug in CLJS

den1k opened this issue · comments

This only happens in CLJS

(= (sort-by identity > (shuffle (range 100)))
   (into [] (x/sort-by identity >) (shuffle (range 100))))

;; => false

Input is returned unchanged:

(into [] (x/sort-by identity >) [3 2 0 4 8 5 6 7 1 9])
;; => [3 2 0 4 8 5 6 7 1 9]

This works in CLJ and CLJS:

(into [] (x/sort-by identity (comparator >)) [3 2 0 4 8 5 6 7 1 9])
;; => [9 8 7 6 5 4 3 2 1 0]

This seems to work in CLJS for me (running on JavaScript core, iOS):

(into [] (x/sort-by identity >) [3 2 0 4 8 5 6 7 1 9])

; => [0 1 2 3 4 5 6 7 8 9]

@den1k is this still an issue for you?

I don't have CLJS REPL handy right now but the environment was the browser. I'm not sure if anything changed in CLJS core or xforms to fix the bug

thanks for fixing this!