Liking cljdoc? Tell your friends :D
All platforms.

sci.core


eval-stringclj/s

(eval-string s)
(eval-string s opts)

Evaluates string s as one or multiple Clojure expressions using the Small Clojure Interpreter.

The map opts may contain the following:

  • :bindings: a map of symbols to values, e.g.: {'x 1}. The symbols will acts as names bound to the corresponding values in the expressions.

  • :namespaces: a map of symbols to namespaces, where a namespace is a map with symbols to values, e.g.: {'foo.bar {'x 1}}. These namespaces can be used with require.

  • :allow: a seqable of allowed symbols. All symbols, even those brought in via :bindings or :namespaces have to be explicitly enumerated.

  • :deny: a seqable of disallowed symbols, e.g.: [loop quote recur].

  • :realize-max: integer; when provided, program may realize a maximum number of elements from sequences, e.g. (vec (range)) will throw for any number. This also applies to sequences returned from the expression to the caller.

  • :preset: a pretermined set of options. Currently only :termination-safe is supported, which will set :realize-max to 100 and disallows the symbols loop, recur and trampoline.

  • :features: when provided a non-empty set of keywords, sci will process reader conditionals using these features (e.g. #{:bb}).

Evaluates string `s` as one or multiple Clojure expressions using the Small Clojure Interpreter.

The map `opts` may contain the following:

- `:bindings`: a map of symbols to values, e.g.: `{'x 1}`. The
symbols will acts as names bound to the corresponding values in the
expressions.

- `:namespaces`: a map of symbols to namespaces, where a namespace
is a map with symbols to values, e.g.: `{'foo.bar {'x 1}}`. These
namespaces can be used with `require`.

- `:allow`: a seqable of allowed symbols. All symbols, even those
brought in via `:bindings` or `:namespaces` have to be explicitly
enumerated.

- `:deny`: a seqable of disallowed symbols, e.g.: `[loop quote
recur]`.

- `:realize-max`: integer; when provided, program may realize a
maximum number of elements from sequences, e.g. `(vec (range))` will
throw for any number. This also applies to sequences returned from
the expression to the caller.

- `:preset`: a pretermined set of options. Currently only
`:termination-safe` is supported, which will set `:realize-max` to
`100` and disallows the symbols `loop`, `recur` and `trampoline`.

- `:features`: when provided a non-empty set of keywords, sci will process reader conditionals using these features (e.g. #{:bb}).
sourceraw docstring

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

× close