Liking cljdoc? Tell your friends :D

beichte.analyze

Effect inference via AST walking.

Performs lightweight abstract interpretation over the effect lattice: walks the tools.analyzer.jvm AST and infers the effect level and feature flags of each node by propagating the join through the call graph.

The analysis is modular: it uses an immutable registry for ground truth and maintains a mutable cache for recursive var analysis. The cache is per-analysis-session, not global.

Two inference modes:

  • infer-effect — returns bare effect level (:pure, :local, etc.)
  • infer-descriptor — returns full descriptor {:effect :level :flags #{...}}
Effect inference via AST walking.

Performs lightweight abstract interpretation over the effect lattice:
walks the tools.analyzer.jvm AST and infers the effect level and
feature flags of each node by propagating the join through the call
graph.

The analysis is modular: it uses an immutable registry for ground
truth and maintains a mutable cache for recursive var analysis.
The cache is per-analysis-session, not global.

Two inference modes:
- `infer-effect`  — returns bare effect level (:pure, :local, etc.)
- `infer-descriptor` — returns full descriptor {:effect :level :flags #{...}}
raw docstring

analyze-exprclj

(analyze-expr expr)
(analyze-expr expr opts)

Analyze an S-expression and return its effect level. For full descriptors with flags, use analyze-expr-full.

opts may include: :analysis — reuse a context from make-analysis (for caching) :registry — custom registry (ignored if :analysis given) :ns — namespace context (default: ns)

Analyze an S-expression and return its effect level.
For full descriptors with flags, use analyze-expr-full.

opts may include:
  :analysis — reuse a context from make-analysis (for caching)
  :registry — custom registry (ignored if :analysis given)
  :ns       — namespace context (default: *ns*)
sourceraw docstring

analyze-expr-fullclj

(analyze-expr-full expr)
(analyze-expr-full expr opts)

Analyze an S-expression and return its full effect descriptor. Returns {:effect :level, :flags #{...}}.

Analyze an S-expression and return its full effect descriptor.
Returns {:effect :level, :flags #{...}}.
sourceraw docstring

analyze-nsclj

(analyze-ns ns-sym)
(analyze-ns ns-sym opts)

Analyze all public vars in a namespace and return a map of {var -> effect}.

Analyze all public vars in a namespace and return a map of {var -> effect}.
sourceraw docstring

analyze-ns-fullclj

(analyze-ns-full ns-sym)
(analyze-ns-full ns-sym opts)

Analyze all public vars and return {var -> descriptor}.

Analyze all public vars and return {var -> descriptor}.
sourceraw docstring

analyze-varclj

(analyze-var v)
(analyze-var v opts)

Analyze a var and return its effect level.

Analyze a var and return its effect level.
sourceraw docstring

analyze-var-fullclj

(analyze-var-full v)
(analyze-var-full v opts)

Analyze a var and return its full effect descriptor.

Analyze a var and return its full effect descriptor.
sourceraw docstring

compilable?clj

(compilable? target expr)
(compilable? target expr opts)

Check if an expression is within the effect budget for a compilation target. Uses full descriptor analysis (checks both state effects and feature flags).

Check if an expression is within the effect budget for a compilation target.
Uses full descriptor analysis (checks both state effects and feature flags).
sourceraw docstring

filter-compilableclj

(filter-compilable target vars)
(filter-compilable target vars opts)

Filter a collection of vars to those compilable for a target.

Filter a collection of vars to those compilable for a target.
sourceraw docstring

infer-descriptorclj

(infer-descriptor analysis ast)
(infer-descriptor analysis visited ast)

Infer the full effect descriptor of an AST node. Returns {:effect :level, :flags #{...}}

Infer the full effect descriptor of an AST node.
Returns {:effect :level, :flags #{...}}
sourceraw docstring

infer-effectclj

(infer-effect analysis ast)
(infer-effect analysis visited ast)

Infer the effect level of an AST node. Returns one of: :pure, :local, :mutation, :io

Infer the effect level of an AST node.
Returns one of: :pure, :local, :mutation, :io
sourceraw docstring

make-analysisclj

(make-analysis)
(make-analysis registry)

Create a fresh analysis state.

  • registry: immutable map of known effects (level or descriptor)
  • cache: atom of {entry -> effect-level}, populated during analysis
Create a fresh analysis state.
- registry: immutable map of known effects (level or descriptor)
- cache: atom of {entry -> effect-level}, populated during analysis
sourceraw docstring

source-varclj

(source-var v)

Retrieve the source code string for a var from classpath or filesystem. Returns the source string, or nil if unavailable.

Retrieve the source code string for a var from classpath or filesystem.
Returns the source string, or nil if unavailable.
sourceraw 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