<< Back to previous view

[CLJS-393] sebseq and sorted-set-by Created: 13/Oct/12  Updated: 27/Jul/13  Resolved: 18/Oct/12

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

Type: Defect Priority: Major
Reporter: Erik Ouchterlony Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: bug

Attachments: File bugfix-PersistentTreeMap.diff    

 Description   

ClojureScript:cljs.user> (subseq (sorted-set-by <= 1 2 3 4 5) >= 2 <= 4)
"Error evaluating:" (subseq (sorted-set-by <= 1 2 3 4 5) >= 2 <= 4) :as "cljs.core.subseq.call(null,cljs.core.sorted_set_by.call(null,cljs.core.LTEQ,1,2,3,4,5),cljs.core.GTEQ,2,cljs.core.LTEQ,4);\n"
org.mozilla.javascript.JavaScriptException: Error: No protocol method IMapEntry.-key defined for type null: (cljs/core.cljs#211)
at cljs/core.cljs:211 (anonymous)
at cljs/core.cljs:203 (_key)
at cljs/core.cljs:5535 (key)
at cljs/core.cljs:2479 (anonymous)
at cljs/core.cljs:1791 (lazy_seq_value)
at cljs/core.cljs:1840 (anonymous)
at cljs/core.cljs:238 (_seq)
at cljs/core.cljs:343 (seq)
at cljs/core.cljs:817 (anonymous)
at cljs/core.cljs:854 (anonymous)
at cljs/core.cljs:857 (anonymous)
at cljs/core.cljs:868 (anonymous)
at cljs/core.cljs:5925 (anonymous)
at cljs/core.cljs:5937 (anonymous)
at <cljs repl>:1 (anonymous)
at <cljs repl>:1



 Comments   
Comment by Erik Ouchterlony [ 17/Oct/12 5:23 PM ]

I've done some further analysis on this problem and found three different issues:

  1. The sorted-set-by in cljs doesn't support ordinary boolean operators, only comparison functions with values -1,0,1.
  2. Bug in PersistentTreeSet lookup. Resolved in CLJS-394
  3. Bug in PersistentTreeMap -sorted-seq-from. I have attached a patch that seems to resolve the issue.
Comment by David Nolen [ 17/Oct/12 9:25 PM ]

So does the patch address both 1 & 3 or only 3?

Comment by Erik Ouchterlony [ 18/Oct/12 2:48 AM ]

Only 3.

Comment by Erik Ouchterlony [ 18/Oct/12 6:04 AM ]

Here is a patch for the third issue.

Comment by Erik Ouchterlony [ 18/Oct/12 4:21 PM ]

I found a small bug in the last patch, so I attached a new one. This patch handles both the remaining issues.

Comment by David Nolen [ 18/Oct/12 5:44 PM ]

fixed, http://github.com/clojure/clojurescript/commit/e3ed0e7b69f9522e8759d0a6567afabb2a98d949

Generated at Fri Nov 28 11:07:12 CST 2014 using JIRA 4.4#649-r158309.