Hi, I can't figure this out. I have these two functions:
(defn get-number []
(try (let [input (read-string (read-line))]
(if (number? input)
input
(get-number)))
(catch Exception e (get-number))))
(defn selection-handler [tests]
(dotimes [i (count tests)]
(printf "(%s) %s: %s\n"
(inc i)
(first (nth tests i))
(or (second (nth tests i))
"--")))
(loop [input (dec (get-number))]
(if ((set (range (count tests))) input)
(nth tests input)
(recur (dec (get-number))))))
Now, the problem is that when I run selection-handler, the dotimes output
isn't printed until (get-number) has returned. Why is this?
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.