Liking cljdoc? Tell your friends :D

sci.ctx-store

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.
raw docstring

sci.impl.async-macro

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))))

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))))
raw docstring

sci.interrupt

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.
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close