Liking cljdoc? Tell your friends :D

pp-grid.api


++clj

(++ & gs)

Convenience wrapper for add to accept grids as args.

Convenience wrapper for add to accept grids as args.
sourceraw docstring

--clj

(-- & gs)

Convenience wrapper for subtract to accept grids as args.

Convenience wrapper for subtract to accept grids as args.
sourceraw docstring

===clj

(=== x-padding & grids)

Horizontally aligns given grids with some defaults.

Just a convenience wrapper for halign to accept grids as args and use some default values for padding and centering.

Horizontally aligns given grids with some defaults.

Just a convenience wrapper for halign to accept grids as args and
use some default values for padding and centering.
sourceraw docstring

addclj

(add & gs)

Constructs a grid with all given grids added together.

Constructs a grid with all given grids added together.
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]
      :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 \+}})

Constructs a grid wrapping given grid into a box.

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

Constructs a grid wrapping given grid into a box.

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

box1clj

(box1 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]
       :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 "┌"}})

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
              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]
       :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 "╒"}})

Constructs a grid wrapping given grid into a box.

Similar to box, but uses different border.

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

Constructs a grid wrapping given grid into a box.

Similar to box, but uses different border.

For example, (box2 (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]
           :or {point-symbol \* draw-axis true x-label "x" y-label "y"}})

Constructs a xy-chart (scatter plot).

For example, (chart-xy (range) [0 1 2 1 0 1 2 1 0]) is y ▲ | | * * |* * * * ------*-▶︎ x

Constructs a xy-chart (scatter plot).

For example, (chart-xy (range) [0 1 2 1 0 1 2 1 0]) is
y
▲
|
| *   *
|* * * *
*---*---*-▶︎ x
sourceraw docstring

decorateclj

(decorate g & escape-codes)

Decorates a grid with given ansi-escape-codes.

Decorates a grid with given ansi-escape-codes.
sourceraw docstring

down-arrowclj

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

Constructs a down-arrow of given length.

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

Constructs a down-arrow of given length.

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

empty-gridclj

(empty-grid)
(empty-grid dimension)
source

ESCAPE-CODE-BACKGROUND-BLACKclj

source

ESCAPE-CODE-BACKGROUND-BLUEclj

source

ESCAPE-CODE-BACKGROUND-BRIGHT-BLACKclj

source

ESCAPE-CODE-BACKGROUND-BRIGHT-BLUEclj

source

ESCAPE-CODE-BACKGROUND-BRIGHT-CYANclj

source

ESCAPE-CODE-BACKGROUND-BRIGHT-GREENclj

source

ESCAPE-CODE-BACKGROUND-BRIGHT-MAGENTAclj

source

ESCAPE-CODE-BACKGROUND-BRIGHT-REDclj

source

ESCAPE-CODE-BACKGROUND-BRIGHT-WHITEclj

source

ESCAPE-CODE-BACKGROUND-BRIGHT-YELLOWclj

source

ESCAPE-CODE-BACKGROUND-CYANclj

source

ESCAPE-CODE-BACKGROUND-GREENclj

source

ESCAPE-CODE-BACKGROUND-MAGENTAclj

source

ESCAPE-CODE-BACKGROUND-REDclj

source

ESCAPE-CODE-BACKGROUND-WHITEclj

source

ESCAPE-CODE-BACKGROUND-YELLOWclj

source

ESCAPE-CODE-BLACKclj

source

ESCAPE-CODE-BLUEclj

source

ESCAPE-CODE-BOLDclj

source

ESCAPE-CODE-BRIGHT-BLACKclj

source

ESCAPE-CODE-BRIGHT-BLUEclj

source

ESCAPE-CODE-BRIGHT-CYANclj

source

ESCAPE-CODE-BRIGHT-GREENclj

source

ESCAPE-CODE-BRIGHT-MAGENTAclj

source

ESCAPE-CODE-BRIGHT-REDclj

source

ESCAPE-CODE-BRIGHT-WHITEclj

source

ESCAPE-CODE-BRIGHT-YELLOWclj

source

ESCAPE-CODE-CYANclj

source

ESCAPE-CODE-GREENclj

source

ESCAPE-CODE-MAGENTAclj

source

ESCAPE-CODE-REDclj

source

ESCAPE-CODE-RESETclj

source

ESCAPE-CODE-REVERSEDclj

source

ESCAPE-CODE-UNDERLINEclj

source

ESCAPE-CODE-WHITEclj

source

ESCAPE-CODE-YELLOWclj

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

grid?clj

(grid? x)
source

halignclj

(halign grids)
(halign grids x-padding y-padding)
(halign grids x-padding y-padding center?)

Constructs a grid containing given grids aligned horizontally.

For example, (halign [(text "A") (text "B") (text "C")]) is ABC.

Constructs a grid containing given grids aligned horizontally.

For example, (halign [(text "A") (text "B") (text "C")]) is ABC.
sourceraw docstring

heightclj

(height x)
source

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

hspacerclj

(hspacer n)

Constructs a horizontal space of given length.

For example, (hspacer 5) is " ".

Constructs a horizontal space of given length.

For example, (hspacer 5) is "     ".
sourceraw docstring

left-arrowclj

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

Constructs a left-arrow of given length.

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

Constructs a left-arrow of given length.

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

left-right-arrowclj

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

Constructs a left-right-arrow of given length.

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

Constructs a left-right-arrow of given length.

For example, (left-right-arrow 4) 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

rendercljmultimethod

source

render-gridcljmultimethod

source

right-arrowclj

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

Constructs a right-arrow of given length.

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

Constructs a right-arrow of given length.

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

spacerclj

(spacer width height)

Constructs a rectangular space of given width and height.

Constructs a rectangular space of given width and height.
sourceraw docstring

subtractclj

(subtract & gs)

Returns the first grid minus keys in rest of the grids.

Returns the first grid minus keys in rest of the grids.
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 header?]
        :or {ns-char \|
             ews-char \+
             nse-char \+
             ew-char \-
             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 | +----+----+

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 |
+----+----+
sourceraw docstring

table0clj

(table0 ks rows)
(table0 ks rows header?)

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

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
sourceraw docstring

table1clj

(table1 ks rows)
(table1 ks rows header?)

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 │ └────┴────┘

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 │
└────┴────┘
sourceraw docstring

table2clj

(table2 ks rows)
(table2 ks rows header?)

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 │ ╰────┴────╯

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 │
╰────┴────╯
sourceraw docstring

table3clj

(table3 ks rows)
(table3 ks rows header?)

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 : :....:....:

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 :
:....:....:
sourceraw docstring

textclj

(text s)
(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

tf-hflipclj

(tf-hflip)
source

tf-projectclj

(tf-project target-dimension)
(tf-project target-dimension project-fn)
source

tf-rotateclj

(tf-rotate radians)
source

tf-rotate-90-degreesclj

(tf-rotate-90-degrees)
source

tf-scaleclj

(tf-scale & ns)
source

tf-translateclj

(tf-translate & deltas)
source

tf-transposeclj

(tf-transpose)
source

tf-vflipclj

(tf-vflip)
source

transformclj

(transform g f)
(transform g f dimension)

Transforms a grid into another grid using given transformation function.

A transformation function accepts a key (coordinate vector) and returns another key.

For example transformation functions, take a look at the tf-* functions.

Transforms a grid into another grid using given transformation function.

A transformation function accepts a key (coordinate vector) and returns another key.

For example transformation functions, take a look at the tf-* functions.
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

up-arrowclj

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

Constructs a up-arrow of given length.

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

Constructs a up-arrow of given length.

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

up-down-arrowclj

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

Constructs a up-down-arrow of given length.

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

Constructs a up-down-arrow of given length.

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

update-rangesclj

(update-ranges metadata & ks)
source

valignclj

(valign grids)
(valign grids x-padding y-padding)
(valign grids x-padding y-padding center?)

Constructs a grid containing given grids aligned vertically.

For example, (valign [(text "A") (text "B") (text "C")]) is A B C

Constructs a grid containing given grids aligned vertically.

For example, (valign [(text "A") (text "B") (text "C")]) is
A
B
C
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

vspacerclj

(vspacer n)

Constructs a vertical space of given length.

For example, (vspacer 5) is (space) (space) (space) (space) (space)

Constructs a vertical space of given length.

For example, (vspacer 5) is
(space)
(space)
(space)
(space)
(space)
sourceraw docstring

widthclj

(width x)
source

||clj

(|| y-padding & grids)

Vertically aligns given grids with some defaults.

Just a convenience wrapper for valign to accept grids as args and use some default values for padding and centering.

Vertically aligns given grids with some defaults.

Just a convenience wrapper for valign to accept grids as args and
use some default values for padding and centering.
sourceraw docstring

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

× close