With a little poking around I found what you need. First, what args
is sort actually taking?
user=> (use '[clojure.contrib.repl-utils :only (show)])
nil
user=> (show java.util.Collections "sort")
=== public java.util.Collections ===
[11] static checkedSortedMap : SortedMap (SortedMap,Class,Class)
[12] static checkedSortedSet : SortedSet (SortedSet,Class)
[40] static sort : void (List)
[41] static sort : void (List,Comparator)
[47] static synchronizedSortedMap : SortedMap (SortedMap)
[48] static synchronizedSortedSet : SortedSet (SortedSet)
[53] static unmodifiableSortedMap : SortedMap (SortedMap)
[54] static unmodifiableSortedSet : SortedSet (SortedSet)
nil
user=> (show java.util.Collections 40)
#<Method public static void java.util.Collections.sort(java.util.List)>
Ah, a java.util.List. But I seem to recall that being an interface,
so I need something else that's concrete and mutable, but implements
List. I seem to recall something called ArrayList...
user=> (isa? java.util.ArrayList java.util.List)
true
Good enough, now how do you make one?
user=> (show java.util.ArrayList)
=== public java.util.ArrayList ===
[ 0] <init> ()
[ 1] <init> (Collection)
[ 2] <init> (int)
[..snip..]
So it can take a collection, like a clojure vector:
user=> (def lst (java.util.ArrayList. ["1" "KB" "K6" "2" "EÜ" "EZ" "ES"]))
#'user/lst
And finally, the sort:
user=> (java.util.Collections/sort lst)
nil
Bleh... not functional at all, are we? Oh well:
user=> lst
#<ArrayList [1, 2, ES, EZ, EÜ, K6, KB]>
And there you go.
--Chouser