print-length-loop

clojure.pprint

  • (print-length-loop bindings & body)
A version of loop that iterates at most *print-length* times. This is designed
for use in pretty-printer dispatch functions.

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/pprint/pprint_base.clj:391 top

(defmacro print-length-loop
  "A version of loop that iterates at most *print-length* times. This is designed 
for use in pretty-printer dispatch functions."
  {:added "1.3"}
  [bindings & body]
  (let [count-var (gensym "length-count")
        mod-body (pll-mod-body count-var body)]
    `(loop ~(apply vector count-var 0 bindings)
       (if (or (not *print-length*) (< ~count-var *print-length*))
         (do ~@mod-body)
         (.write ^java.io.Writer *out* "...")))))
Vars in clojure.pprint/print-length-loop:
Used in 0 other vars

Comments top

No comments for print-length-loop. Log in to add a comment.