(with-monad state-m
(defn- add-line
"Read one line and add it to the end of the vector lines. Return
[lines eof], where eof is an end-of-file flag. The input eof argument
is not used."
[[lines eof]]
(domonad
[line (read-line)]
(if (nil? line)
[lines true]
[(conj lines line) false])))
(defn read-lines
"Read all lines and return them in a vector"
[]
(domonad
[[lines eof] (state-m-until second add-line [[] false])]
lines)))
Vars in
clojure.contrib.monadic-io-streams/read-lines:
defn
defn-
nil?
Used in 0 other vars
Comments top
No comments for read-lines. Log in to add a comment.