Run-time environment vars, facilities for printing to console.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
(ns foo.baz
  (:api dunaj)
  (:require [dunaj.env :refer [with-meta host-newline]]))

;; printing

(def x ^:foo [1 nil {:foo 'bar} "d\\\n" :f])

;; similar to clojure.core/pr
(pr! x)
;; [1 nil {:foo bar} "d\\\n" :f]
;;=> nil

;; similar to clojure.core/pr-str
(str (print-one clj x))
;;=> "[1 nil {:foo bar} \"d\\\\\\n\" :f]"

;; similar to clojure.core/print
(print! x)
;; [1 nil {:foo bar} d\
;;  :f]
;;=> nil

;; similar to clojure.core/print-str
(str (print-one (assoc clj :human-printer? true) x))
;;=> "[1 nil {:foo bar} d\\\n :f]"

;; similar to clojure.core/println
(println! x)
;; [1 nil {:foo bar} d\
;;  :f]
;;
;;=> nil

;; similar to clojure.core/println-str
(str (append host-newline (print-one (assoc clj :human-printer? true) x)))
;;=> "[1 nil {:foo bar} d\\\n :f]\n"

;; similar to clojure.core/prn
(prn! x)
;; [1 nil {:foo bar} "d\\\n" :f]
;;
;;=> nil

;; similar to clojure.core/prn-str
(str (append host-newline (print-one clj x)))
;;=> "[1 nil {:foo bar} \"d\\\\\\n\" :f]\n"

;; similar to clojure.core/printf
(out! (print "%d-%s" 5 "foo"))
;; 5-foo
;;=> 5

(with-meta (pp! x))
;; ^{:foo true} [1 nil {:foo bar} "d\\\n" :f]
;;=> nil"

Primary

command-line-args

Available since version 1.0 (view source)

Usage:
  • (command-line-args)

Type signature:
  • () → (Maybe IRed)

Returns a collection of the supplied command line arguments, or nil if none were supplied.

compiling?

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (compiling?)

Type signature:
  • () → Boolean+

Returns true if compiling files, false otherwise.

current-file

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (current-file)

Type signature:
  • () → (Maybe Uri)

Returns URI of the currently evaluated file or nil, if there is no file, e.g. in the REPL.

See also: compiling?

current-ns

Available since version 1.0 (view source)

Usage:
  • (current-ns)

Type signature:
  • () → Symbol

Returns a symbol representing the current namespace.

current-version

Available since version 1.0 (view source)

Usage:
  • (current-version)

Type signature:
  • () → Version

Returns current version.

data-readers

Available since version 1.0 (view source)

not referred automatically

VAR of type Var

A dynamic var which stores current data readers mappings, excluding default ones, created by the system.

default-data-reader-fn

Available since version 1.0 (view source)

not referred automatically

VAR of type Var

A dynamic var which stores default data reader fn.

See also: data-readers

in-bare-ns

Available since version 1.0 (view source)

not referred automatically

MACRO (in-bare-ns ns)

Sets current namespace to the namespace named by the symbol ns, creating it if needed. Uses bare API preset.

See also: in-ns, dunaj.lib/ns

in-ns

Available since version 1.0 (alias of clojure.core/in-ns)

not referred automatically

VAR of type nil

Sets current namespace to the namespace named by the symbol ns, creating it if needed. Uses clojure API preset.

Console

color

Available since version 1.0 (view source)

not referred automatically

VAR of type Var

A dynamic var holding color flag used in pretty printing.

default-pretty-printer

Available since version 1.0 (view source)

not referred automatically

VAR of type Var

A dynamic var holding default pretty printer factory used in pretty! function.

See also: default-printer, pp!

default-printer

Available since version 1.0 (view source)

not referred automatically

VAR of type Var

A dynamic var holding default printer factory used in pr! and prn! functions.

err

Available since version 1.0 (view source)

VAR of type Var

A dynamic var holding default error resource.

See also: err!, in, out

err!

Available since version 1.0 (view source)

Usage:
  • (err! coll)

Type signature:
  • (Any) → nil

Prints contents of coll to the current error output, returning nil.

See also: out!, err

flush!

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (flush!)

Type signature:
  • () → nil

Flushes default output resource. Returns nil.

See also: out, out!

host-newline

Available since version 1.0 (view source)

not referred automatically

VAR of type String+

A host newline string.

See also: print!, out!

in

Available since version 1.0 (view source)

VAR of type Var

A dynamic var holding default input resource.

See also: out, err

meta

Available since version 1.0 (view source)

not referred automatically

VAR of type Var

A dynamic var holding meta flag used in pretty printing.

See also: with-meta, pp!

out

Available since version 1.0 (view source)

VAR of type Var

A dynamic var holding default output resource.

See also: print!, out!, err, in, flush!

out!

Available since version 1.0 (view source)

Usage:
  • (out! coll)

Type signature:
  • (Any) → nil

Prints contents of coll to the current output, returning nil.

See also: out, err!, print!

pp!

Available since version 1.0 (view source)

Usage:
  • (pp! & xs)

Type signature:
  • ((Va Any)) → nil

Pretty prints given items to the current output and returns nil.

See also: println!, print!

pr!

Available since version 1.0 (view source)

Usage:
  • (pr! & xs)

Type signature:
  • ((Va Any)) → nil

Prints given items to the current output and returns nil.

See also: prn!, print!

Available since version 1.0 (view source)

Usage:
  • (print! & xs)

Type signature:
  • ((Va Any)) → nil

Prints given items to the current output and returns nil. Meant for human consumption. Does not print quotes around strings, does not escape chars.

See also: println!, pp!, pr!

println!

Available since version 1.0 (view source)

Usage:
  • (println! & xs)

Type signature:
  • ((Va Any)) → nil

Prints given items to the current output and returns nil. Meant for human consumption.

Does not print quotes around strings, does not escape chars. Prints newline at the end.

See also: print!, prn!, pp!

prn!

Available since version 1.0 (view source)

Usage:
  • (prn! & xs)

Type signature:
  • ((Va Any)) → nil

Prints given items to the current output and returns nil. Prints newline at the end.

See also: pr!, println!

with-color

Available since version 1.0 (view source)

not referred automatically

MACRO (with-color & body)

A macro which executes body with color flag set to true.

with-meta

Available since version 1.0 (view source)

not referred automatically

MACRO (with-meta & body)

A macro which executes body with meta flag set to true.

See also: meta, pp!

Other

In this section: newline!

newline!

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (newline!)

Type signature:
  • () → nil

Writes a platform-specific newline to out