Clojure While Loop

clojure, java, loops, while-loop

Solution

I don't know Clojure, but it looks that, like Scheme, it supports "let loops":

(loop [char (readChar)]
   (if (= char delimiter)
       '()
       (do (some-processing)
           (recur (readChar)))))

Hope this is enough to get you started. I referred to http://clojure.org/special_forms#toc9 to answer this question.

NOTE: I know that Clojure discourages side-effects, so presumably you want to return something useful instead of '().

Problem

I trying clojure i am trying to figure out how to implement the following algorithm, I am reading from an input stream i want to continue reading until it is not a delimiter character. i can do this in java with a while loop but i can't seem to figure out how to do it in clojure? ``` while read readChar != delimiter do some processing.... end while ```

Original source