Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sort fails for lists and vectors #66

Open
elh opened this issue Apr 3, 2024 · 1 comment
Open

sort fails for lists and vectors #66

elh opened this issue Apr 3, 2024 · 1 comment

Comments

@elh
Copy link
Contributor

elh commented Apr 3, 2024

cursory git bisect points at the rewrites in commit 0a8a035 shortly after the initial sort test. sort might've been broken since then(?)

Context

installed glj at latest via go install.

This seems like this was (is?) passing in this test

(let [sorted (sort xs)

Error

user=> (sort [3 2 1])
ToSlice not supported on type: *lang.Vector

GLJ Stack:
glojure/core.glj:3092:14:	(to-array coll)
glojure/core.glj:3089:4:	(sort compare coll)
repl:1:1:	(sort [3 2 1])
user=> (sort '(3 2 1))
unable to resolve symbol: java.util.Arrays
Stack trace (most recent call first):

	<unknown>:?:?


GLJ Stack:
glojure/core.glj:3089:4:	(sort compare coll)
repl:1:1:	(sort (quote (3 2 1)))

Happy to take a look with pointers

@jfhamlin
Copy link
Contributor

jfhamlin commented Apr 4, 2024

Thanks for the report! If you want to take a stab at it:

Bug 1

ToSlice should support more than just ISeqs. We'll want to match Clojure's toArray behavior.

Bug 2

We need a rewrite rule that maps (. java.util.Arrays (sort a comp)) to an equivalent call to sort.Slice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants