Skip to content

Strings

pr-str

Prints a variable number of values into a string, separated by whitespace. Each collection type follows its own printing rule. In addition, strings are escaped.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
(pr-str "hello" "world")

(pr-str [1 2 3 4])
(pr-str (vector 1 2 3 4))

(pr-str (list 1 2 3 4))

(pr-str {"key" "value"})
(pr-str (hash-map "key" "value"))

(pr-str {:key1 (vector 1 2 3)} {:key2 (list 1 2 3 4)})
""hello" "world""

"[1 2 3 4]"
"[1 2 3 4]"

"(1 2 3 4)"

"{"key" "value"}"
"{"key" "value"}"

"{:key1 [1 2 3]} {:key2 (1 2 3 4)}"
See also

slurp

Reads the content of a file into a string. The path can be absolute or relative to the script.

(slurp "file.txt")

str

Prints a variable number of values into a string, without whitespace separation. Each collection type follows its own printing rule.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
(str "hello" "world")

(str [1 2 3 4])
(str (vector 1 2 3 4))

(str (list 1 2 3 4))

(str {"key" "value"})
(str (hash-map "key" "value"))

(str {:key1 (vector 1 2 3)} {:key2 (list 1 2 3 4)})
"helloworld"

"[1 2 3 4]"
"[1 2 3 4]"

"(1 2 3 4)"

"{"key" value}"
"{"key" value}"

"{:key1 [1 2 3]}{:key2 (1 2 3 4)}"
See also