Liking cljdoc? Tell your friends :D

automat.core


$clj/s

($ tag)

Defines a state tag, which can be correlated to a reducer function using compile.

Defines a state tag, which can be correlated to a reducer function using `compile`.
sourceraw docstring

*clj/s

(* & args)

Returns an automaton that accepts zero or more of the given automata.

Returns an automaton that accepts zero or more of the given automata.
sourceraw docstring

+clj/s

(+ & args)

Returns an automaton that accepts one or more of the given automaton.

Returns an automaton that accepts one or more of the given automaton.
sourceraw docstring

?clj/s

(? & args)

Returns an automaton that accepts zero or one of the given automaton.

Returns an automaton that accepts zero or one of the given automaton.
sourceraw docstring

advanceclj/s

(advance fsm state input)
(advance fsm state input reject-value)

Advances a single position in the automaton. Takes a compiled fsm, a state which is either an initial reduce value or a CompiledAutomatonState previously returned by advance, and an input.

If a reject-value is specified, it will be returned if an invalid input is given. Otherwise an IllegalArgumentException is thrown.

Advances a single position in the automaton.  Takes a compiled `fsm`, a `state` which is either an initial reduce
value or a CompiledAutomatonState previously returned by `advance`, and an input.

If a `reject-value` is specified, it will be returned if an invalid input is given.  Otherwise an IllegalArgumentException is thrown.
sourceraw docstring

advance-streamclj/s

(advance-stream fsm state stream reject-value)

Advances through the the stream, stopping if the stream is accepted or rejected. If the input state is accepted?, proceeds anyway. If rejected, reject-value is returned in lieu of the new state.

If an input state is already accepted and reject-value is returned, this means that inputs beyond the accepted sub-sequence have been consumed. As such, be careful when using impure functions and input sources.

Advances through the the stream, stopping if the stream is accepted or rejected.  If the input state is `accepted?`,
proceeds anyway.  If rejected, `reject-value` is returned in lieu of the new state.

If an input state is already accepted and `reject-value` is returned, this means that inputs beyond the accepted sub-sequence
have been consumed.  As such, be careful when using impure functions and input sources.
sourceraw docstring

andclj/s

(and & args)

Returns an automaton that accepts the intersection the given automata.

Returns an automaton that accepts the intersection the given automata.
sourceraw docstring

anyclj/s

Returns an automaton that accepts any single input value.

Returns an automaton that accepts any single input value.
sourceraw docstring

compileclj/s

(compile fsm)
(compile fsm {:keys [backend action-comparator] :as options})

Compiles the fsm into something that can be used with find, advance-stream, greedy-find, and advance. Optionally takes an option map, which may contain:

reducers - a map or function of actions defined via $ onto reducer functions which take two arguments, the current reduction value and the input.

signal - a function that takes an input and returns the signal that will be used to advance the automaton. The input passed into reducer functions will not be affected by this.

action-comparator - an optional comparator function used to sort actions. The default is compare.

Compiles the fsm into something that can be used with `find`, `advance-stream`, `greedy-find`, and `advance`.  Optionally takes an option map, which may contain:

`reducers` - a map or function of actions defined via `$` onto reducer functions which take two arguments, the current reduction value and the input.

`signal` - a function that takes an input and returns the signal that will be used to advance the automaton.  The input passed into reducer functions will not be affected by this.

`action-comparator` - an optional comparator function used to sort actions. The default is `compare`.
sourceraw docstring

complementclj/s

(complement & args)

Returns the complement of the given automaton.

Returns the complement of the given automaton.
sourceraw docstring

differenceclj/s

(difference & args)

Returns an automaton that accepts the disjoint of the first automaton and the subsequent automata.

Returns an automaton that accepts the disjoint of the first automaton and the subsequent
automata.
sourceraw docstring

findclj/s

(find fsm state stream)

Searches for a accepted sub-sequence within the stream. If an input sequence is rejected, begins again at the automaton's start state. If the input state is accepted?, returns immediately.

If the returned state has accepted? set to true, the matching sub-sequence is from start-index to stream-index. Since no inputs past the match are consumed, this can be safely used with impure functions and input sources.

Searches for a accepted sub-sequence within the stream.  If an input sequence is rejected, begins again at the automaton's
start state. If the input state is `accepted?`, returns immediately.

If the returned state has `accepted?` set to true, the matching sub-sequence is from `start-index` to `stream-index`. Since
no inputs past the match are consumed, this can be safely used with impure functions and input sources.
sourceraw docstring

greedy-findclj/s

(greedy-find fsm state stream)

Greedily find the largest possible accepted sub-sequence. Will only return an accepted? state once subsequent inputs have been rejected. Since this always consumes more inputs than the accepted sub-sequence, be careful when using impure functions or input sources.

Greedily find the largest possible accepted sub-sequence.  Will only return an `accepted?` state once subsequent
inputs have been rejected.  Since this always consumes more inputs than the accepted sub-sequence, be careful when
using impure functions or input sources.
sourceraw docstring

interpose-$clj/s

(interpose-$ tag fsm)

Applies a state tag to all states within the given automaton.

Applies a state tag to all states within the given automaton.
sourceraw docstring

is-identical?clj/s

source

matching-inputsclj/s

(matching-inputs fsm)

Returns a lazy sequence of input sequences which the automaton will match.

Returns a lazy sequence of input sequences which the automaton will match.
sourceraw docstring

noneclj/s

Returns an automaton that immediately accepts.

Returns an automaton that immediately accepts.
sourceraw docstring

notclj/s

(not & args)

Returns the complement of any zero or one-transition automata. Equivalent to the character negation ^ operator in regular expressions.

Returns the complement of any zero or one-transition automata.  Equivalent to the character
negation `^` operator in regular expressions.
sourceraw docstring

orclj/s

(or & args)

Returns an automaton that accepts the union of the given automata.

Returns an automaton that accepts the union of the given automata.
sourceraw docstring

precompileclj/s≠

clj
(precompile fsm)

Takes an fsm, and returns a data structure where states are represented by numbers, and the provided keys are :accept, :state->input->state, and :state->input->actions. The start state will always be 0.

Takes an fsm, and returns a data structure where states are represented by
numbers, and the provided keys are :accept, :state->input->state,
and :state->input->actions.  The start state will always be `0`.
cljs
source (clj)source (cljs)raw docstring

rangeclj/s

(range lower upper)

Returns an automaton which matches any input within the inclusive range of [upper, lower].

Returns an automaton which matches any input within the inclusive range of [upper, lower].
sourceraw docstring

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

× close