Hi Meikel,

I'm not sure I'm following your example, I ran this code (in Clojure 1.4)  
- it does not echo back the input and it does not seem to work lazily i.e. 
also hangs:

(defn -main
  [& args]
  ;; https://groups.google.com/d/msg/clojure/kYNWcfajHhY/5FcSk3B71mwJ
  (println "Input something:")
  (loop [lines (repeatedly read-line)]
    (let [line (first lines)]
      (println "You entered:" line)
      (when (not= "q" line)
        (recur (next lines))))))


Regards,
Swaroop

On Monday, July 2, 2012 1:16:37 PM UTC+5:30, Meikel Brandmeyer (kotarak) 
wrote:
>
> Hi,
>
> you wait for five lines. So you have to enter five lines. Enter three more 
> and the "hung" will go away.
>
> If you want to read an arbitrary number of lines and bail out depending on 
> some decision you may use a lazy sequence.
>
> (loop [lines (repeatedly read-line)]
>   (let [line (first lines)]
>     (when-not (bail-out? line)
>       ...
>       (recur (next lines)))))
>
> Kind regards
> Meikel
>
>

-- 
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

Reply via email to