Liking cljdoc? Tell your friends :D

pattern.r3.rule


*debug-rules*clj


*identity-rule-post-processor*clj

Transform the resulting value or env of a successful identity rule.

See *post-processor* for details.

The value and orig-value arguments will be identical.

Transform the resulting value or env of a successful identity rule.

See [[*post-processor*]] for details.

The value and orig-value arguments will be identical.
raw docstring

*post-processor*clj

Transform the resulting value or env of a successful rule in the context of the original value and env.

Argument and return signature:

(fn [rule value orig-value env orig-env] [value env])

Set to nil to skip post-processing.

See also *identity-rule-post-processor*, [[raw]], and others.

Transform the resulting value or env of a successful rule in the context of
the original value and env.

Argument and return signature:

(fn [rule value orig-value env orig-env]
  [value env])

Set to nil to skip post-processing.

See also [[*identity-rule-post-processor*]], [[raw]], and others.
raw docstring

dict-handlerclj

(dict-handler match-procedure)

do-pattern-replaceclj

(do-pattern-replace pattern)

invoke-ruleclj

(invoke-rule rule data env {:keys [on-match on-result]} succeed fail)

make-ruleclj

(make-rule orig-pattern handler)
(make-rule orig-pattern handler metadata)
(make-rule orig-pattern handler ->get-values post-process metadata)

Compiler for rules. Returns a function that when called with a datum either returns the original value or if the pattern matches and the handler returns a value, return the value returned by the handler.

Rules are meant to be combined via the combinators library.

By default, calls the handler with a simple dictionary of matches - configured via the dict-handler arg transformer -, but a custom arg transformation can be specified by providing ->get-values, which is called with the compiled match-procedure at compile time, then the result of that is called with the results dictionary and applied to the handler.

Note that the [[rule]] macro enables splicing even in simple quoted rules, but that is only possible with a macro. To get the same behaviour with the make-rule function directly, either use the pattern/quo macro to turn spliceable syntax quoted lists into regular quoted lists by stripping the namespace from all symbols, or use regular syntax-quoted lists.

Compiler for rules. Returns a function that when called with a datum either
returns the original value or if the pattern matches and the handler returns a
value, return the value returned by the handler.

Rules are meant to be combined via the combinators library.

By default, calls the handler with a simple dictionary of matches - configured
via the [[dict-handler]] arg transformer -, but a custom arg transformation can
be specified by providing ->get-values, which is called with the compiled
match-procedure at compile time, then the result of that is called with the
results dictionary and applied to the handler.

Note that the [[rule]] macro enables splicing even in simple quoted rules, but
that is only possible with a macro. To get the same behaviour with the
make-rule function directly, either use the [[pattern/quo]] macro to turn spliceable
syntax quoted lists into regular quoted lists by stripping the namespace from
all symbols, or use regular syntax-quoted lists.
raw docstring

post-processclj

(post-process rule value orig-value env orig-env)

RebuildRulecljprotocol

-rebuild-ruleclj

(-rebuild-rule rule match-procedure handler)

Rebuild a rule with the same value extraction and post-processing.

Optionally specify replacement match-procedure or replacement handler.

Metadata may be updated the usual way.

Rebuild a rule with the same value extraction and post-processing.

Optionally specify replacement match-procedure or replacement handler.

Metadata may be updated the usual way.

rule-nameclj

(rule-name rule)

Get the name or pattern to identify the rule.

Get the name or pattern to identify the rule.
raw docstring

run-ruleclj

(run-rule rule datum env)
(run-rule rule datum events env)

Runs a rule and returns either the successfully updated value or the original if the rule fails.

Runs a rule and returns either the successfully updated value or the original
if the rule fails.
raw docstring

unwrapclj

(unwrap original x)

If a value was marked as (success x), unwraps and returns x.

If a value was marked as (success x), unwraps and returns x.
raw docstring

unwrap-envclj

(unwrap-env env x)

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

× close