pr-sequential-writer

functionsince v0.0-1503Edit
(pr-sequential-writer writer print-one begin sep end opts coll)

Source code @ clojurescript:src/main/cljs/cljs/core.cljs
(defn pr-sequential-writer [writer print-one begin sep end opts coll]
  (binding [*print-level* (when-not (nil? *print-level*) (dec *print-level*))]
    (if (and (not (nil? *print-level*)) (neg? *print-level*))
      (-write writer "#")
      (do
        (-write writer begin)
        (if (zero? (:print-length opts))
          (when (seq coll)
            (-write writer (or (:more-marker opts) "...")))
          (do
            (when (seq coll)
              (print-one (first coll) writer opts))
            (loop [coll (next coll) n (dec (:print-length opts))]
              (if (and coll (or (nil? n) (not (zero? n))))
                (do
                  (-write writer sep)
                  (print-one (first coll) writer opts)
                  (recur (next coll) (dec n)))
                (when (and (seq coll) (zero? n))
                  (-write writer sep)
                  (-write writer (or (:more-marker opts) "...")))))))
        (-write writer end)))))