*output On Tuesday, October 7, 2014 8:17:34 PM UTC-4, adrian...@mail.yu.edu wrote: > > You need to flush the input stream after printing. Call > (clojure.core/flush) to do so. > > On Tuesday, October 7, 2014 4:51:05 PM UTC-4, Johannes Langøy wrote: >> >> 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 clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.