Liking cljdoc? Tell your friends :D

pp-grid.object


arrow-downclj

(arrow-down n)
(arrow-down n body-char)
(arrow-down n body-char head-char)

Constructs a down arrow of given length.

For example, (arrow-down 4) is │ │ │ ▼

Constructs a down arrow of given length.

For example, (arrow-down 4) is
│
│
│
▼
sourceraw docstring

arrow-leftclj

(arrow-left n)
(arrow-left n body-char)
(arrow-left n body-char head-char)

Constructs a left arrow of given length.

For example, (arrow-left 4) is '◀───'.

Constructs a left arrow of given length.

For example, (arrow-left 4) is '◀───'.
sourceraw docstring

arrow-left-rightclj

(arrow-left-right n)
(arrow-left-right n body-char)
(arrow-left-right n body-char left-head-char right-head-char)

Constructs a left-right arrow of given length.

For example, (arrow-left-right 4) is '◀──▶︎'.

Constructs a left-right arrow of given length.

For example, (arrow-left-right 4) is '◀──▶︎'.
sourceraw docstring

arrow-neclj

(arrow-ne n)
(arrow-ne n body-char)
(arrow-ne n body-char start-char end-char)

Constructs an arrow pointing north-east of given length.

For example, (arrow-ne 4) is * / / /

Constructs an arrow pointing north-east of given length.

For example, (arrow-ne 4) is
   *
  /
 /
/
sourceraw docstring

arrow-nwclj

(arrow-nw n)
(arrow-nw n body-char)
(arrow-nw n body-char start-char end-char)

Constructs an arrow pointing north-west of given length.

For example, (arrow-nw 4) is -- ignore the double lines. Can't put it here without escaping it! *

\

Constructs an arrow pointing north-west of given length.

For example, (arrow-nw 4) is -- ignore the double lines. Can't put it here
without escaping it!
*
 \
  \
   \
sourceraw docstring

arrow-rightclj

(arrow-right n)
(arrow-right n body-char)
(arrow-right n body-char head-char)

Constructs a right arrow of given length.

For example, (arrow-right 4) is '───▶︎'.

Constructs a right arrow of given length.

For example, (arrow-right 4) is '───▶︎'.
sourceraw docstring

arrow-seclj

(arrow-se n)
(arrow-se n body-char)
(arrow-se n body-char start-char end-char)

Constructs an arrow pointing south-east of given length.

For example, (arrow-se 4) is -- ignore the double lines. Can't put it here without escaping it!


*

Constructs an arrow pointing south-east of given length.

For example, (arrow-se 4) is -- ignore the double lines. Can't put it here
without escaping it!
\
 \
  \
   *
sourceraw docstring

arrow-swclj

(arrow-sw n)
(arrow-sw n body-char)
(arrow-sw n body-char start-char end-char)

Constructs an arrow pointing south-west of given length.

For example, (arrow-sw 4) is / / / *

Constructs an arrow pointing south-west of given length.

For example, (arrow-sw 4) is
   /
  /
 /
*
sourceraw docstring

arrow-upclj

(arrow-up n)
(arrow-up n body-char)
(arrow-up n body-char head-char)

Constructs an up arrow of given length.

For example, (arrow-up 4) is ▲ │ │ │

Constructs an up arrow of given length.

For example, (arrow-up 4) is
▲
│
│
│
sourceraw docstring

arrow-up-downclj

(arrow-up-down n)
(arrow-up-down n body-char)
(arrow-up-down n body-char up-head-char down-head-char)

Constructs a up-down arrow of given length.

For example, (arrow-up-down 4) is ▲ │ │ ▼

Constructs a up-down arrow of given length.

For example, (arrow-up-down 4) is
▲
│
│
▼
sourceraw docstring

boxclj

(box g
     &
     {:keys [left-padding right-padding top-padding bottom-padding
             left-border-char right-border-char top-border-char
             bottom-border-char top-left-corner-char top-right-corner-char
             bottom-left-corner-char bottom-right-corner-char fill-escape-codes]
      :or {top-right-corner-char \+
           top-padding 0
           top-border-char \-
           bottom-border-char \-
           left-border-char \|
           right-border-char \|
           bottom-left-corner-char \+
           bottom-padding 0
           right-padding 0
           left-padding 0
           bottom-right-corner-char \+
           top-left-corner-char \+}
      :as provided-opts})

Constructs a grid wrapping given grid (or a string-convertible value) into a box.

For example, (box (text "HELLO")) is +-----+ |HELLO| +-----+

Constructs a grid wrapping given grid (or a string-convertible value) into a box.

For example, (box (text "HELLO")) is
+-----+
|HELLO|
+-----+
sourceraw docstring

box0clj

(box0 g
      &
      {:keys [left-padding right-padding top-padding bottom-padding
              fill-escape-codes]
       :or {left-padding 0 right-padding 0 top-padding 0 bottom-padding 0}})

Constructs a grid wrapping given grid into a border-less box.

For example, (box0 (text "HELLO")) is

HELLO

Constructs a grid wrapping given grid into a border-less box.

For example, (box0 (text "HELLO")) is

 HELLO

sourceraw docstring

box1clj

(box1 g
      &
      {:keys [left-padding right-padding top-padding bottom-padding
              fill-escape-codes]
       :or {left-padding 0 right-padding 0 top-padding 0 bottom-padding 0}})

Constructs a grid wrapping given grid into a box.

Similar to box, but uses different border.

For example, (box1 (text "HELLO")) is ┌─────┐ │HELLO│ └─────┘

Constructs a grid wrapping given grid into a box.

Similar to box, but uses different border.

For example, (box1 (text "HELLO")) is
┌─────┐
│HELLO│
└─────┘
sourceraw docstring

box2clj

(box2 g
      &
      {:keys [left-padding right-padding top-padding bottom-padding
              fill-escape-codes]
       :or {left-padding 0 right-padding 0 top-padding 0 bottom-padding 0}})

Constructs a grid wrapping given grid into a box.

Similar to box, but uses border with rounded corners.

For example, (box2 (text "HELLO")) is ╭─────╮ │HELLO│ ╰─────╯

Constructs a grid wrapping given grid into a box.

Similar to box, but uses border with rounded corners.

For example, (box2 (text "HELLO")) is
╭─────╮
│HELLO│
╰─────╯
sourceraw docstring

box3clj

(box3 g
      &
      {:keys [left-padding right-padding top-padding bottom-padding
              fill-escape-codes]
       :or {left-padding 0 right-padding 0 top-padding 0 bottom-padding 0}})

Constructs a grid wrapping given grid into a box.

Similar to box, but uses different border.

For example, (box3 (text "HELLO")) is ╒═════╕ │HELLO│ ╘═════╛

Constructs a grid wrapping given grid into a box.

Similar to box, but uses different border.

For example, (box3 (text "HELLO")) is
╒═════╕
│HELLO│
╘═════╛
sourceraw docstring

box4clj

(box4 g
      &
      {:keys [left-padding right-padding top-padding bottom-padding
              fill-escape-codes]
       :or {left-padding 0 right-padding 0 top-padding 0 bottom-padding 0}})

Constructs a grid wrapping given grid into a box.

Similar to box, but uses different border.

For example, (box4 (text "HELLO")) is ╒═════╕ │HELLO│ ╘═════╛

Constructs a grid wrapping given grid into a box.

Similar to box, but uses different border.

For example, (box4 (text "HELLO")) is
╒═════╕
│HELLO│
╘═════╛
sourceraw docstring

box5clj

(box5 g
      &
      {:keys [left-padding right-padding top-padding bottom-padding
              fill-escape-codes]
       :or {left-padding 0 right-padding 0 top-padding 0 bottom-padding 0}})

Constructs a grid wrapping given grid into a box.

Similar to box, but uses '*' for all border characters.

For example, (box5 (text "HELLO")) is


HELLO


Constructs a grid wrapping given grid into a box.

Similar to box, but uses '*' for all border characters.

For example, (box5 (text "HELLO")) is
*******
*HELLO*
*******
sourceraw docstring

chart-barclj

(chart-bar ns
           &
           {:keys [labels max-length bar-symbol horizontal]
            :or {labels ns horizontal true}})

Constructs a bar chart.

For example, (chart-bar [10 20 30 40]) is ■■■■■■■■■■■■■ 10 ■■■■■■■■■■■■■■■■■■■■■■■■■■■ 20 ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 30 ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 40

Constructs a bar chart.

For example, (chart-bar [10 20 30 40]) is
■■■■■■■■■■■■■ 10
■■■■■■■■■■■■■■■■■■■■■■■■■■■ 20
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 30
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 40
sourceraw docstring

chart-xyclj

(chart-xy xs
          ys
          &
          {:keys [point-symbol draw-axis x-label y-label max-width max-height]
           :or {point-symbol \*
                draw-axis true
                x-label "x"
                y-label "y"
                max-width 40
                max-height 10}})

Constructs a xy-chart (scatter plot).

For example, (chart-xy (range) [0 1 2 1 0 1 2 1 0] :max-height 2 :max-width 10) is y ▲ | | * * |* * * * --------*-▶ x

Constructs a xy-chart (scatter plot).

For example, (chart-xy (range) [0 1 2 1 0 1 2 1 0] :max-height 2 :max-width 10) is
y
▲
|
|  *    *
|*  * *  *
*----*----*-▶ x
sourceraw docstring

decorateclj

(decorate x escape-code & escape-codes)

Decorates a grid or a string-convertible value with given ansi-escape-codes.

Decorates a grid or a string-convertible value with given ansi-escape-codes.
sourceraw docstring

default-box-optionsclj

source

fillclj

(fill w h)
(fill w h c)

Constructs a filler of given width and height.

For example, (fill 4 4 *) is





Constructs a filler of given width and height.

For example, (fill 4 4 \*) is
****
****
****
****
sourceraw docstring

hfillclj

(hfill n)
(hfill n c)

Constructs a horizontal-filler of given size.

For example, (hfill 3 *) is '***'.

Constructs a horizontal-filler of given size.

For example, (hfill 3 \*) is '***'.
sourceraw docstring

hlineclj

(hline n)
(hline n body-char)
(hline n body-char start-char end-char)

Constructs a horizontal line of given length.

For example, (hline 3) is '---'.

Constructs a horizontal line of given length.

For example, (hline 3) is '---'.
sourceraw docstring

matrixclj

(matrix ks rows)
(matrix ks rows header?)

Constructs a matrix.

Similar to table, but changes the border to make it look more like a matrix.

For example, (matrix [:a :b] [{:a 1 :b 2} {:a 3 :b 4}]) is ╭ ╮ │ :a :b │ │ │ │ 1 2 │ │ 3 4 │ ╰ ╯

Constructs a matrix.

Similar to table, but changes the border to make it look more like a matrix.

For example, (matrix [:a :b] [{:a 1 :b 2} {:a 3 :b 4}]) is
╭           ╮
│  :a   :b  │
│           │
│   1    2  │
│   3    4  │
╰           ╯
sourceraw docstring

paragraphclj

(paragraph s)
(paragraph s padding)
(paragraph s pad-left pad-right)
(paragraph s pad-left pad-right max-width)
(paragraph s pad-left pad-right max-width first-line-indent)

Constructs a grid containing a paragraph of text.

By default paragraphs have max-width of 80 chars. If any word is longer than max-width chars, it will appear alone in a line without being truncated.

Constructs a grid containing a paragraph of text.

By default paragraphs have max-width of 80 chars. If any word
is longer than max-width chars, it will appear alone in a line without
being truncated.
sourceraw docstring

tableclj

(table ks
       rows
       &
       {:keys [nsew-char nse-char nsw-char ewn-char ews-char ns-char ew-char
               nw-char ne-char se-char sw-char align header? row-decorations]
        :or {ns-char \|
             ews-char \+
             nse-char \+
             ew-char \-
             align :right
             ne-char \+
             nw-char \+
             nsw-char \+
             header? true
             se-char \+
             ewn-char \+
             sw-char \+
             nsew-char \+}})

Constructs a table.

Produces similar table as clojure.pprint/print-table.

Adapted from source-code of clojure.pprint/print-table.

For example, (table [:a :b] [{:a 1 :b 2} {:a 3 :b 4}]) is +----+----+ | :a | :b | +----+----+ | 1 | 2 | | 3 | 4 | +----+----+

By default, columns are right aligned. For left pass in ':align :left', for center pass ':align :center'.

row-decorations keyword-argument can be provided. It is a sequence of ansi-escape codes. If header? is true, the header will be decorated with the first ansi-escape code in row-decorations. And the other rows will be decorated with the rest -- if there aren't enough, we'll just cycle over the given ansi-escape-codes. For example, try (table [:a :b] [{:a 1 :b 2} {:a 3 :b 4}] :align :left :row-decorations [ESCAPE-CODE-BACKGROUND-BRIGHT-GREEN ESCAPE-CODE-BACKGROUND-BRIGHT-MAGENTA ESCAPE-CODE-BACKGROUND-BLUE])

Constructs a table.

Produces similar table as clojure.pprint/print-table.

Adapted from source-code of clojure.pprint/print-table.

For example, (table [:a :b] [{:a 1 :b 2} {:a 3 :b 4}]) is
+----+----+
| :a | :b |
+----+----+
|  1 |  2 |
|  3 |  4 |
+----+----+

By default, columns are right aligned. For left pass in ':align :left', for
center pass ':align :center'.

row-decorations keyword-argument can be provided. It is a sequence
of ansi-escape codes. If header? is true, the header will be decorated with
the first ansi-escape code in row-decorations. And the other rows will be decorated
with the rest -- if there aren't enough, we'll just cycle over the
given ansi-escape-codes. For example, try
(table [:a :b] [{:a 1 :b 2} {:a 3 :b 4}]
       :align :left
       :row-decorations [ESCAPE-CODE-BACKGROUND-BRIGHT-GREEN
                         ESCAPE-CODE-BACKGROUND-BRIGHT-MAGENTA
                         ESCAPE-CODE-BACKGROUND-BLUE])
sourceraw docstring

table*clj

(table* grids n)

Constructs a n-column, border-less, header-less table with given grids.

Just a convenience wrapper around table0. For more customization, use table0 or table functions.

Constructs a n-column, border-less, header-less table with given grids.

Just a convenience wrapper around table0. For more customization, use
table0 or table functions.
sourceraw docstring

table0clj

(table0 ks rows)
(table0 ks rows header?)
(table0 ks rows header? align)
(table0 ks rows header? align row-decorations)

Constructs a border-less table.

For example, (table0 [:a :b] [{:a 1 :b 2} {:a 3 :b 4}]) is

:a :b

1 2 3 4

Rows can be decorated with row-decorations argument, which is a sequence of ansi-escape-codes. Please see docstring for table.

Constructs a border-less table.

For example, (table0 [:a :b] [{:a 1 :b 2} {:a 3 :b 4}]) is

 :a   :b

  1    2
  3    4

Rows can be decorated with row-decorations argument, which is a sequence of ansi-escape-codes.
Please see docstring for table.
sourceraw docstring

table1clj

(table1 ks rows)
(table1 ks rows header?)
(table1 ks rows header? align)
(table1 ks rows header? align row-decorations)

Constructs a table.

Similar to table but uses different border.

For example, (table1 [:a :b] [{:a 1 :b 2} {:a 3 :b 4}]) is ┌────┬────┐ │ :a │ :b │ ├────┼────┤ │ 1 │ 2 │ │ 3 │ 4 │ └────┴────┘

Rows can be decorated with row-decorations argument, which is a sequence of ansi-escape-codes. Please see docstring for table.

Constructs a table.

Similar to table but uses different border.

For example, (table1 [:a :b] [{:a 1 :b 2} {:a 3 :b 4}]) is
┌────┬────┐
│ :a │ :b │
├────┼────┤
│  1 │  2 │
│  3 │  4 │
└────┴────┘

Rows can be decorated with row-decorations argument, which is a sequence of ansi-escape-codes.
Please see docstring for table.
sourceraw docstring

table2clj

(table2 ks rows)
(table2 ks rows header?)
(table2 ks rows header? align)
(table2 ks rows header? align row-decorations)

Constructs a table.

Similar to table but uses different border (rounded corners).

For example, (table2 [:a :b] [{:a 1 :b 2} {:a 3 :b 4}]) is ╭────┬────╮ │ :a │ :b │ ├────┼────┤ │ 1 │ 2 │ │ 3 │ 4 │ ╰────┴────╯

Rows can be decorated with row-decorations argument, which is a sequence of ansi-escape-codes. Please see docstring for table.

Constructs a table.

Similar to table but uses different border (rounded corners).

For example, (table2 [:a :b] [{:a 1 :b 2} {:a 3 :b 4}]) is
╭────┬────╮
│ :a │ :b │
├────┼────┤
│  1 │  2 │
│  3 │  4 │
╰────┴────╯

Rows can be decorated with row-decorations argument, which is a sequence of ansi-escape-codes.
Please see docstring for table.
sourceraw docstring

table3clj

(table3 ks rows)
(table3 ks rows header?)
(table3 ks rows header? align)
(table3 ks rows header? align row-decorations)

Constructs a table.

Similar to table but uses dotted border.

For example, (table3 [:a :b] [{:a 1 :b 2} {:a 3 :b 4}]) is ........... : :a : :b : ..........: : 1 : 2 : : 3 : 4 : :....:....:

Rows can be decorated with row-decorations argument, which is a sequence of ansi-escape-codes. Please see docstring for table.

Constructs a table.

Similar to table but uses dotted border.

For example, (table3 [:a :b] [{:a 1 :b 2} {:a 3 :b 4}]) is
...........
: :a : :b :
..........:
:  1 :  2 :
:  3 :  4 :
:....:....:

Rows can be decorated with row-decorations argument, which is a sequence of ansi-escape-codes.
Please see docstring for table.
sourceraw docstring

textclj

(text s)
(text s padding)
(text s pad-left pad-right)
(text s pad-left pad-right pad-char)

Constructs a grid containing given string.

If s is not a string, then (str s) will be used.

Each line in the string is put in a new row.

Constructs a grid containing given string.

If s is not a string, then (str s)
will be used.

Each line in the string is put in a new row.
sourceraw docstring

treeclj

(tree node)
(tree node text-wrapper-fn)
(tree node x-padding y-padding)
(tree node x-padding y-padding text-wrapper-fn)
(tree node x-padding y-padding text-wrapper-fn branch-marker)

Constructs a tree representation of a sequence.

An element of the sequence can be another sequence or a grid or anything that can be converted to a string.

For example, (tree [1 2 [3 [4 5] [6 7] 8]]) is ┌───┐ │ 1 │ └───┘ │ ┌───┐ │ 2 │ └───┘ │ ┌───┐ ┌───┐ ┌───┐ ┌───┐ │ 3 │ │ 4 │ │ 6 │ │ 8 │ └───┘ └───┘ └───┘ └───┘ │ │ ┌───┐ ┌───┐ │ 5 │ │ 7 │ └───┘ └───┘

Constructs a tree representation of a sequence.

An element of the sequence can be another sequence or a grid or
anything that can be converted to a string.

For example, (tree [1 2 [3 [4 5] [6 7] 8]]) is
┌───┐
│ 1 │
└───┘
│
┌───┐
│ 2 │
└───┘
│
┌───┐  ┌───┐  ┌───┐  ┌───┐
│ 3 │  │ 4 │  │ 6 │  │ 8 │
└───┘  └───┘  └───┘  └───┘
       │      │
       ┌───┐  ┌───┐
       │ 5 │  │ 7 │
       └───┘  └───┘
sourceraw docstring

vfillclj

(vfill n)
(vfill n c)

Constructs a vertical-filler of given size.

For example, (vfill 3 *) is * * *

Constructs a vertical-filler of given size.

For example, (vfill 3 \*) is
*
*
*
sourceraw docstring

vlineclj

(vline n)
(vline n body-char)
(vline n body-char start-char end-char)

Constructs a vertical line of given length.

For example, (vline 3) is | | |

Constructs a vertical line of given length.

For example, (vline 3) is
|
|
|
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close