I can read some data in like this in the repl. For a real program I plan to assign in a let special form.
(def x1 (line-seq (BufferedReader. (StringReader. x1))))
If I enter 5 5, x1 is bound to (“5 5”)
I would like to convert this list of one element into a list of two integers. How can I do that? I have been playing around with parsing the string on whitespace, but am having trouble performing the conversion to integer.
Does this help? In Clojure 1.3.0:
In case the Clojure version you’re using doesn’t have
clojure.stringnamespace you can skip theusecommand and define the function in a following way.You can get rid of regular expressions by using
(.split string " ")in the last line.