1.2.0 permalink Arrow_down_16x16

pprint-logical-block

clojure.contrib.pprint

  • (pprint-logical-block options* body)
Execute the body as a pretty printing logical block with output to *out* which
must be a pretty printing writer. When used from pprint or cl-format, this can be
assumed.

Before the body, the caller can optionally specify options: :prefix, :per-line-prefix,
and :suffix.

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

(defmacro pprint-logical-block 
  "Execute the body as a pretty printing logical block with output to *out* which 
must be a pretty printing writer. When used from pprint or cl-format, this can be 
assumed. 

Before the body, the caller can optionally specify options: :prefix, :per-line-prefix, 
and :suffix."
  {:arglists '[[options* body]]}
  [& args]
  (let [[options body] (parse-lb-options #{:prefix :per-line-prefix :suffix} args)]
    `(do (if (level-exceeded) 
           (.write ^java.io.Writer *out* "#")
           (binding [*current-level* (inc *current-level*)
                     *current-length* 0] 
             (start-block *out*
                          ~(:prefix options) ~(:per-line-prefix options) ~(:suffix options))
             ~@body
             (end-block *out*)))
         nil)))
Vars in clojure.contrib.pprint/pprint-logical-block: level-exceeded defmacro let *out* apply binding concat hash-map inc list seq vector with-meta

Comments top

No comments for pprint-logical-block. Log in to add a comment.