hara.common.emit-data

default-map-key

added in 4.0

(default-map-key key grammar nsp)

emits a default map key

emit-coll

added in 3.0

(emit-coll key form grammar mopts)(emit-coll key form grammar mopts emit-fn)

emits a collection

emit-coll-layout

added in 4.0

(emit-coll-layout key indent str-array grammar mopts)

constructs the collection

emit-data

added in 3.0

(emit-data key form grammar mopts)

main function for data forms

emit-data-standard

added in 4.0

(emit-data-standard key form grammar mopts)

emits either a custom string or default coll

emit-map-entry

added in 3.0

(emit-map-entry [k v] grammar mopts)

emits the map entry

emit-map-key

added in 4.0

(emit-map-key form grammar mopts)

emits the map key

emit-maybe-multibody

added in 4.0

(emit-maybe-multibody [prefix-yes prefix-no] body & [indent])

checks that array is all single lines

(emit-maybe-multibody “1” “2” “hello”) => “2hello”

(emit-maybe-multibody “1” “2” “\nhello”) => “1 \n hello”

emit-quote

added in 4.0

(emit-quote key props [sym & args :as form] grammar mopts)

emit quote structures

(emit-quote nil nil ''(1 2 3) +grammar+ {}) => “(1,2,3)”

emit-singleline-array?

added in 4.0

(emit-singleline-array? body-arr)

checks that array is all single lines

(emit-singleline-array? “1” “2” “3”) => true

(emit-singleline-array? “1” “\n2” “3”) => false

emit-table

added in 4.0

(emit-table _ _ [_ & args] grammar mopts)

emit quote structures

(emit-table nil nil ’(tab :a 1 :b 2) +grammar+ {}) => “{"a":1,"b":2}”

emit-table-group

added in 4.0

(emit-table-group args)

gets table group

(emit-table-group :a 1 :b 2 :c :d)

test-data-emit

(test-data-emit form grammar mopts)

test-data-loop

added in 4.0

(test-data-loop form grammar mopts)

emit for data structures

(test-data-loop ’(+ 1 2) +grammar+ {}) => “(+ 1 2)

(test-data-loop ’{:a (+ 1 2)} +grammar+ {}) => “{:a (+ 1 2)}”

(test-data-loop ’#{(+ 1 2)} +grammar+ {}) => throws

:quote (test-data-loop ''((+ A B) C) +grammar+ {}) => “((+ A B),C)”

(test-data-loop ''(+ A B) C +grammar+ {}) => “(+ A B),C”

:table (test-data-loop ’(tab :a (+ 1 2) :b 2) +grammar+ {}) => “{"a":(+ 1 2),"b":2}”

(test-data-loop ’(tab 1 (+ 1 2) 3 4 5) +grammar+ {}) => “{1,(+ 1 2),3,4,5}”