Liking cljdoc? Tell your friends :D

lexikon.core


*warn-on-late-eval*clj


binding-contextcljmacro

(binding-context k & body)

Retrieves a stored lexical context from memory and binds it using let.

(context! :k {'a 1})

(binding-context :k
  (inc a))
=> 2

Note: you can only bind a context if its key is known at compile time.
Retrieves a stored lexical context from memory and binds it using
`let`.

```clojure
(context! :k {'a 1})

(binding-context :k
  (inc a))
=> 2

Note: you can only bind a context if its key is known at compile time.
```
raw docstring

contextclj

(context k)
(context k kk)

Fetches a map stored in memory under key k. If kk is provided, fetches kk in k.

Fetches a map stored in memory under key `k`. If `kk` is provided,
fetches `kk` in `k`.
raw docstring

context!clj

(context! k ctx)
(context! k key value)

Stores a map in memory under key k. Merges with the previous context if present.

(context! :k {'a 123})
(context! :k 'b 456)

(context :k)
=> {'a 123 'b 456}
Stores a map in memory under key `k`. Merges with the previous
context if present.

```clojure
(context! :k {'a 123})
(context! :k 'b 456)

(context :k)
=> {'a 123 'b 456}
```
raw docstring

contextsclj

The global store for contexts. An atom containing a map of maps: {key -> {symbol -> value}}

The global store for contexts. An atom containing a map of maps:
`{key -> {symbol -> value}}`
raw docstring

delete-context!clj

(delete-context! k)

Deletes the map stored in memory under key k.

Deletes the map stored in memory under key `k`.
raw docstring

letmapcljmacro

(letmap m & body)

Binds each key of m to the corresponding value. Keys in m must be litteral symbols. If m is not a litteral map nor a macro that expands to one, lexical-eval will be used at runtime. However this will print a warning. Set *warn-on-late-eval* to false to silence it. m can be quoted or not.

(letmap '{a 1 b 2}
  [a b])
=> [1 2]
Binds each key of `m` to the corresponding value. Keys in `m` must
be litteral symbols. If `m` is not a litteral map nor a macro that
expands to one, `lexical-eval` will be used at runtime.
However this will print a warning. Set `*warn-on-late-eval*` to
false to silence it. `m` can be quoted or not.

```clojure
(letmap '{a 1 b 2}
  [a b])
=> [1 2]
```
raw docstring

lexical-contextcljmacro

(lexical-context & {:as opts})

Returns the current lexical context as a map from symbols to values. In macros (or anywhere &env is a local in scope), lexical-context will expand to code that will return the context of the expanded form rather than the context of the macro itself. Use (lexical-context :local true) to override this behavior.

(let [a 1 b 2 c 3]
  (lexical-context))
=> {'a 1 'b 2 'c 3}
Returns the current lexical context as a map from symbols to
values. In macros (or anywhere `&env` is a local in scope),
`lexical-context` will expand to code that will return the context
of the expanded form rather than the context of the macro itself.
Use `(lexical-context :local true)` to override this behavior.

```clojure
(let [a 1 b 2 c 3]
  (lexical-context))
=> {'a 1 'b 2 'c 3}
```
raw docstring

lexical-evalcljmacro

(lexical-eval code)
(lexical-eval ctx code)

Evaluates code in the given lexical context. If no context is passed, lexical-context is used.

(let [a 1]                  ; CompilerException:
  (eval '(inc a))           ; Unable to resolve symbol: a in this context

  (lexical-eval (inc a))    ; => 2
  (lexical-eval {'a 22} a)) ; => 22
Evaluates code in the given lexical context. If no context is
passed, [[lexical-context]] is used.

```clojure
(let [a 1]                  ; CompilerException:
  (eval '(inc a))           ; Unable to resolve symbol: a in this context

  (lexical-eval (inc a))    ; => 2
  (lexical-eval {'a 22} a)) ; => 22
```
raw docstring

lexical-mapcljmacro

(lexical-map & args)

Turns a collection of symbols into a map of symbols to their value in the current lexical context. If params is not a litteral nor expands to one, lexical-eval will be used at runtime. However this will print a warning. Set *warn-on-late-eval* to false to silence it.

(let [a 1 b 2 c 3]
  (lexical-map '[a b])                 ; => {'a 1 'b 2}
  (lexical-map '[a b] :keywords true)) ; => {:a 1 :b 2}
Turns a collection of symbols into a map of symbols to their value
in the current lexical context.
If `params` is not a litteral nor expands to one, `lexical-eval`
will be used at runtime.
However this will print a warning. Set `*warn-on-late-eval*` to
false to silence it.

```clojure
(let [a 1 b 2 c 3]
  (lexical-map '[a b])                 ; => {'a 1 'b 2}
  (lexical-map '[a b] :keywords true)) ; => {:a 1 :b 2}
```
raw docstring

lexical-resolvecljmacro

(lexical-resolve x)
(lexical-resolve lex x)

Resolve symbol in the current or given lexical context.

Resolve symbol in the current or given lexical context.
raw docstring

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

× close