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
(defnsort"Returns a sorted sequence of the items in coll. If no comparator is supplied, uses compare. comparator must implement java.util.Comparator. Guaranteed to be stable: equal elements will not be reordered. If coll is a Java array, it will be modified. To avoid this, sort a copy of the array."
([coll]
(sort compare coll))
([#_java.util.Comparator comp coll]
;; (if (seq coll);; (let [a (to-array coll)];; (. java.util.Arrays (sort a comp));; (with-meta (seq a) (meta coll)));; ())
(throw"TODO: port")))
The Clojure JVM version is included in there. As we can see, the collection is put into an array, the array is sorted, and then we return a sequence (carrying over the meta from the collection).
We currently have this:
The Clojure JVM version is included in there. As we can see, the collection is put into an array, the array is sorted, and then we return a sequence (carrying over the meta from the collection).
References
Steps
object_ptr sort(object_ptr coll);
toruntime/core/seq.hpp
runtime/core/seq.cpp
visit_seqable
to get a seqable, turn it into a seq, and then fill up anative_vector<object_ptr>
std::stable_sort
on the vectornative_vector_sequence
box which takes ownership of the sorted vectorcore_native.cpp
to add anintern_fn
call to wrap yoursort
fnclojure/core.jank
to forward theclojure.core-native/sort
defThe text was updated successfully, but these errors were encountered: