1.2.0 permalink Arrow_down_16x16
  • (write-lines f lines)
Writes lines (a seq) to f, separated by newlines. f is opened with
writer, and automatically closed at the end of the sequence.

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/duck_streams.clj:225 top

(defn write-lines
  "Writes lines (a seq) to f, separated by newlines.  f is opened with
  writer, and automatically closed at the end of the sequence."
  [f lines]
  (with-open [^PrintWriter writer (writer f)]
    (loop [lines lines]
      (when-let [line (first lines)]
        (.write writer (str line))
        (.println writer)
        (recur (rest lines))))))
Vars in clojure.contrib.duck-streams/write-lines: defn loop rest str when-let with-open
Used in 0 other vars

Comments top

No comments for write-lines. Log in to add a comment.