std.block.type

*tab-width*

dynamic

block-compare

added in 3.0

(block-compare this other)

compares equality of two blocks

(block-compare (construct/void \space) (construct/void \space)) => 0

code-block?

added in 4.0

(code-block? block)

checks if a block can be representated as code

comment-block

added in 3.0

(comment-block string)

constructs a comment block

(-> (comment-block “;hello”) (base/block-info)) => {:type :comment, :tag :comment, :string “;hello”, :height 0, :width 6}

comment-block?

added in 3.0

(comment-block? block)

checks if the block is a token block

(comment-block? (construct/comment “;;hello”)) => true

container-block

added in 3.0

(container-block tag children props)

constructs a container block

(-> (container-block :fn (construct/token ’+) (construct/void) (construct/token ’1) (construct/container-props :fn)) (base/block-value)) => ’(fn* [](+ 1))

container-block?

added in 3.0

(container-block? block)

checks if block is a container block

(container-block? (construct/block [])) => true

container-height

added in 3.0

(container-height block)

calculates the height of a container

(container-height (construct/block [])) => 0

(container-height (construct/block (construct/newline))) => 1

(container-height (construct/block (construct/newline) (construct/newline))) => 2

container-string

multimethod

added in 3.0

returns the string for the container

(container-string (construct/block 1 2 3)) => “1 2 3

container-value-string

added in 3.0

(container-value-string block)

returns the string for

(container-value-string (construct/block ::a :b :c)) => “:std.block.type-test/a :b :c

(container-value-string (parse/parse-string “::a :b :c”)) => “(keyword ":a") (keyword "b") (keyword "c")

container-width

added in 3.0

(container-width block)

calculates the width of a container

(container-width (construct/block 1 2 3 4)) => 9

eof-block?

added in 3.0

(eof-block? block)

checks if input is an eof block

(eof-block? (construct/void nil)) => true

linebreak-block?

added in 3.0

(linebreak-block? block)

checks if block is of type :linebreak

(linebreak-block? (construct/newline)) => true

linespace-block?

added in 3.0

(linespace-block? block)

checks if block is of type :linespace

(linespace-block? (construct/space)) => true

modifier-block

added in 3.0

(modifier-block tag string command)

creates a modifier block, specifically #_

(modifier-block :hash-uneval “#_” (fn acc _ acc))

modifier-block?

added in 3.0

(modifier-block? block)

checks if block is a modifier block

(modifier-block? (construct/uneval)) => true

nil-void?

added in 3.0

(nil-void? block)

checks if block is nil or type void block

(nil-void? nil) => true

(nil-void? (construct/block nil)) => false

(nil-void? (construct/space)) => true

space-block?

added in 3.0

(space-block? block)

checks if block is of type \space

(space-block? (construct/space)) => true

token-block

added in 3.0

(token-block tag string value value-string width height)

creates a token block

(base/block-info (token-block :symbol “abc” ’abc “abc” 3 0)) => {:type :token, :tag :symbol, :string “abc”, :height 0, :width 3}

token-block?

added in 3.0

(token-block? block)

checks if the block is a token block

(token-block? (construct/token “hello”)) => true

void-block

added in 3.0

(void-block tag ch width height)

constructs a void block

(-> (void-block :linespace \tab 1 0) (base/block-info)) => {:type :void, :tag :linespace, :string “\t”, :height 0, :width 1}

void-block?

added in 3.0

(void-block? block)

checks if the block is a void block

(void-block? (construct/void)) => true