I've defined the following 3 functions using the leiningen REPL:
(defn rand-int-range [floor ceiling] (+ floor (rand-int (- ceiling floor))))
(defn mutate-index
"mutates one index in an array of char and returns the new mutated array"
[source idx]
(map
#(if (= %1 idx)
(char (+ (int %2) (rand-int-range -3 3)))
%2)
(iterate inc 0)
source))
(defn mutate-string
[source]
(str
(mutate-index
(.toCharArray source)
(rand-int (alength (.toCharArray source))))))
When I run (mutate-string "hello"), instead of the REPL printing out the mutated string, it is printing out clojure.lang.LazySeq@xxxxxx where the 'xxxxx' is a random sequence of numbers and letters. I would expect it to instead print something like "hellm" Is this really giving me a string back like I think? If it is, how can I get the REPL to show me that string?