You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Implement sort function for Glojure
- Add SortSlice function in pkg/lang/sort.go that performs stable in-place sorting
- Add Compare function to support Clojure's compare semantics (nil handling, cross-type numeric comparison)
- Update ToSlice to handle all required types: nil→empty, IPersistentVector, IPersistentMap, string→char array
- Add transformation in rewrite.clj to replace java.util.Arrays.sort with SortSlice
- Add transformation for clojure.lang.Util.compare to use Compare function
The implementation matches Clojure JVM semantics:
- Stable sort (equal elements maintain order)
- Comparator contract (-1/0/1 return values)
- Proper nil handling (nil sorts before non-nil)
- Support for custom comparators
* Add sort tests
Signed-off-by: James Hamlin <[email protected]>
* Update number compare
Signed-off-by: James Hamlin <[email protected]>
* Use Comparer interface a la Java Comparable
Signed-off-by: James Hamlin <[email protected]>
* Sort test files for consistent run order
Signed-off-by: James Hamlin <[email protected]>
* Fix sort-by
Signed-off-by: James Hamlin <[email protected]>
* Add more sort-by tests
Signed-off-by: James Hamlin <[email protected]>
---------
Signed-off-by: James Hamlin <[email protected]>
0 commit comments