The main SCI API namespace.
The main SCI API namespace.
Canonical place for projects to store, update and retrieve a context.
This can be used by projects that need to expose their context to
functions. SCI binds this dynamic var to the evaluating context during
eval-form. Projects like sci.configs assume this var to be set in
some of their functions.
Canonical place for projects to store, update and retrieve a context. This can be used by projects that need to expose their context to functions. SCI binds this dynamic var to the evaluating context during `eval-form`. Projects like `sci.configs` assume this var to be set in some of their functions.
Transforms async function bodies with await into Promise .then chains.
Supports await in:
Example: (defn ^:async foo [] (let [x (await (js/Promise.resolve 1))] (inc x)))
Transforms to: (defn foo [] (.then (js/Promise.resolve 1) (fn [x] (inc x))))
Transforms async function bodies with await into Promise .then chains.
Supports await in:
- let bindings: (let [x (await p)] ...)
- do forms: (do (await p) ...)
- arbitrary expressions: (inc (await p))
- macros like -> are expanded first
Example:
(defn ^:async foo []
(let [x (await (js/Promise.resolve 1))]
(inc x)))
Transforms to:
(defn foo []
(.then (js/Promise.resolve 1) (fn [x] (inc x))))Opt-in, interrupt-fn aware overrides for core functions that iterate over
host sequences without ever entering an interpreted function, and therefore
never hit the per-fn-entry :interrupt-fn check.
This namespace is NOT loaded by default and adds nothing to a standard SCI
build unless you require it. Merge clojure-core into your context's
clojure.core namespace to make these functions interruptible:
(require '[sci.core :as sci]
'[sci.interrupt :as interrupt])
(sci/init {:interrupt-fn my-interrupt-fn
:namespaces {'clojure.core interrupt/clojure-core}})
Each override reads :interrupt-fn from the current context at call time and
falls back to the native function when no :interrupt-fn is configured, so
merging clojure-core is always safe.
Opt-in, interrupt-fn aware overrides for core functions that iterate over
host sequences without ever entering an interpreted function, and therefore
never hit the per-fn-entry `:interrupt-fn` check.
This namespace is NOT loaded by default and adds nothing to a standard SCI
build unless you require it. Merge `clojure-core` into your context's
`clojure.core` namespace to make these functions interruptible:
(require '[sci.core :as sci]
'[sci.interrupt :as interrupt])
(sci/init {:interrupt-fn my-interrupt-fn
:namespaces {'clojure.core interrupt/clojure-core}})
Each override reads `:interrupt-fn` from the current context at call time and
falls back to the native function when no `:interrupt-fn` is configured, so
merging `clojure-core` is always safe.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |