Im trying to make the change to Clojure from a primarily Java only experience and i am trying to solve a problem in Clojure. I can do it in Java and it shouldnt be too much harder to convert to Clojure but i just cannot see how it would work....
What i want to do is iterate over an array of strings and then for ever string put into a map, my pseudo code is below but looks alot like Java
private static void putToMap(String w)
{
String thisw = getthisw(w);
if (!map.containsKey(thisw))
{
map.put(thisw, w);
map.add(w);
}
}
private static String getthisw(String w)
{
char [] wArray = w.toLowerCase().toCwarArray();
Arrays.sort(wArray);
return new String(wArray);
}
This is how i am trying to do it in Clojure but im not sure how i would get data from the array that is given in the output if there is any?
The output i get from running what i have is this.... How would i use this to iterate over?? if so how would i use the array im given??
#<String[] [Ljava.lang.String;@790da477>
My Clojure functions....
(def strings '["one" "two" "three" "four" "five" ])
(defn sort [strings]
(into-array String strings))
Example of input:
Array of Strings ["ONE"] ["TWO"] ["THREE"] ["FOUR"] ["FIVE"]
Example of output:
Map with strings converted to lowercase "one" "two" "three" "four" "five"