1.2.0 permalink Arrow_down_16x16
  • (read-lines)
Read all lines and return them in a vector

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/contrib/monadic_io_streams.clj:126 top

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