(alter-var-root v f & args)
Atomically alters the root binding of sci var v by applying f to its current value plus any args.
Atomically alters the root binding of sci var v by applying f to its current value plus any args.
(binding bindings & body)
Macro for binding sci vars. Must be called with a vector of sci dynamic vars to values.
Macro for binding sci vars. Must be called with a vector of sci dynamic vars to values.
(copy-var sym ns)
Copies contents from var sym
to a new sci var. The value ns
is an
object created with sci.core/create-ns
.
Copies contents from var `sym` to a new sci var. The value `ns` is an object created with `sci.core/create-ns`.
(create-ns sym)
(create-ns sym meta)
Creates namespace object. Can be used in var metadata.
Creates namespace object. Can be used in var metadata.
Sci var that represents sci's clojure.core/*err*
Sci var that represents sci's `clojure.core/*err*`
(eval-form ctx form)
Evaluates form (as produced by parse-string
or parse-next
) in the
context of ctx
(as produced with init
). To allow namespace
switches, establish root binding of sci/ns
with sci/binding
or
sci/with-bindings.
Evaluates form (as produced by `parse-string` or `parse-next`) in the context of `ctx` (as produced with `init`). To allow namespace switches, establish root binding of `sci/ns` with `sci/binding` or `sci/with-bindings.`
(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:
: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
.
:bindings
: :bindings x
is the same as :namespaces {'user x}
.
: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]
.
:features
: when provided a non-empty set of keywords, sci will process reader conditionals using these features (e.g. #{:bb}).
:env
: an atom with a map in which state from the
evaluation (defined namespaced and vars) will be persisted for
re-use over multiple calls.
:disable-arity-checks
: disables arity checks for single-arity
functions.
Evaluates string `s` as one or multiple Clojure expressions using the Small Clojure Interpreter. The map `opts` may contain the following: - `: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`. - `:bindings`: `:bindings x` is the same as `:namespaces {'user x}`. - `: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]`. - `:features`: when provided a non-empty set of keywords, sci will process reader conditionals using these features (e.g. #{:bb}). - `:env`: an atom with a map in which state from the evaluation (defined namespaced and vars) will be persisted for re-use over multiple calls. - `:disable-arity-checks`: disables arity checks for single-arity functions.
(eval-string* ctx s)
Evaluates string s
in the context of ctx
(as produced with
init
).
Evaluates string `s` in the context of `ctx` (as produced with `init`).
Sci var that represents sci's clojure.core/*file*
Sci var that represents sci's `clojure.core/*file*`
(fork ctx)
Forks a context (as produced with init
) into a new context. Any new
vars created in the new context won't be visible in the original
context.
Forks a context (as produced with `init`) into a new context. Any new vars created in the new context won't be visible in the original context.
(format-stacktrace stacktrace)
Returns a list of formatted stack trace elements as strings from stacktrace.
Returns a list of formatted stack trace elements as strings from stacktrace.
(future & body)
Like clojure.core/future but also conveys sci bindings to the thread.
Like clojure.core/future but also conveys sci bindings to the thread.
Sci var that represents sci's clojure.core/*in*
Sci var that represents sci's `clojure.core/*in*`
(init opts)
Creates an initial sci context from given options opts
. The context
can be used with eval-string*
. See eval-string
for available
options. The internal organization of the context is implementation
detail and may change in the future.
Creates an initial sci context from given options `opts`. The context can be used with `eval-string*`. See `eval-string` for available options. The internal organization of the context is implementation detail and may change in the future.
(intern ctx sci-ns name)
(intern ctx sci-ns name val)
Finds or creates a sci var named by the symbol name in the namespace ns (which can be a symbol or a sci namespace), setting its root binding to val if supplied. The namespace must exist in the ctx. The sci var will adopt any metadata from the name symbol. Returns the sci var.
Finds or creates a sci var named by the symbol name in the namespace ns (which can be a symbol or a sci namespace), setting its root binding to val if supplied. The namespace must exist in the ctx. The sci var will adopt any metadata from the name symbol. Returns the sci var.
(merge-opts ctx opts)
Updates a context with opts merged in and returns it.
Updates a context with opts merged in and returns it.
(new-dynamic-var name)
(new-dynamic-var name init-val)
(new-dynamic-var name init-val meta)
Same as new-var but adds :dynamic true to meta.
Same as new-var but adds :dynamic true to meta.
(new-macro-var name init-val)
(new-macro-var name init-val meta)
Same as new-var but adds :macro true to meta as well as :sci/macro true to meta of the fn itself.
Same as new-var but adds :macro true to meta as well as :sci/macro true to meta of the fn itself.
(new-var name)
(new-var name init-val)
(new-var name init-val meta)
Returns a new sci var.
Returns a new sci var.
Sci var that represents sci's clojure.core/*ns*
Sci var that represents sci's `clojure.core/*ns*`
(ns-name sci-ns)
Returns name of SCI ns as symbol.
Returns name of SCI ns as symbol.
Sci var that represents sci's clojure.core/*out*
Sci var that represents sci's `clojure.core/*out*`
(parse-next ctx reader)
(parse-next ctx reader opts)
Parses next form from reader
Parses next form from reader
(parse-string ctx s)
Parses string s
in the context of ctx
(as produced with
init
).
Parses string `s` in the context of `ctx` (as produced with `init`).
(pmap f coll)
(pmap f coll & colls)
Like clojure.core/pmap but also conveys sci bindings to the threads.
Like clojure.core/pmap but also conveys sci bindings to the threads.
Sci var that represents sci's cljs.core/*print-fn*
Sci var that represents sci's `cljs.core/*print-fn*`
Sci var that represents sci's clojure.core/*print-length*
Sci var that represents sci's `clojure.core/*print-length*`
Sci var that represents sci's clojure.core/*print-level*
Sci var that represents sci's `clojure.core/*print-level*`
Sci var that represents sci's clojure.core/*print-meta*
Sci var that represents sci's `clojure.core/*print-meta*`
Sci var that represents sci's cljs.core/*print-newline*
Sci var that represents sci's `cljs.core/*print-newline*`
Sci var that represents sci's clojure.core/*print-readably*
Sci var that represents sci's `clojure.core/*print-readably*`
(reader x)
Coerces x into indexing pushback-reader to be used with parse-next. Accepts: string or java.io.Reader.
Coerces x into indexing pushback-reader to be used with parse-next. Accepts: string or java.io.Reader.
(set! dynamic-var v)
Establish thread local binding of dynamic var
Establish thread local binding of dynamic var
(stacktrace ex)
Returns list of stacktrace element maps from exception, if available.
Returns list of stacktrace element maps from exception, if available.
(with-bindings bindings-map & body)
Macro for binding sci vars. Must be called with map of sci dynamic vars to values. Used in babashka.
Macro for binding sci vars. Must be called with map of sci dynamic vars to values. Used in babashka.
(with-in-str s & body)
Evaluates body in a context in which sci's in is bound to a fresh StringReader initialized with the string s.
Evaluates body in a context in which sci's *in* is bound to a fresh StringReader initialized with the string s.
(with-out-str & body)
Evaluates exprs in a context in which sci's out is bound to a fresh StringWriter. Returns the string created by any nested printing calls.
Evaluates exprs in a context in which sci's *out* is bound to a fresh StringWriter. Returns the string created by any nested printing calls.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close