(cat A1 A2)Takes two automata A1 and A2, and returns a new automaton that accepts an input S iff there exists two strings S1 and S2, such that a1 accepts S1, a2 accepts S2, and S1 + S2 = S.
Takes two automata A1 and A2, and returns a new automaton that accepts an input S iff there exists two strings S1 and S2, such that a1 accepts S1, a2 accepts S2, and S1 + S2 = S.
(check-state all-states state)(intersection A1 A2)Takes two automata A1 and A2, and returns a new automaton that accepts an input iff both A1 and A2 would accept it.
Takes two automata A1 and A2, and returns a new automaton that accepts an input iff both A1 and A2 would accept it.
(make-automaton all-states transitions initial-state final-states)Creates a Choco FiniteAutomaton object to be used in loco constraints. Takes as arguments:
Creates a Choco FiniteAutomaton object to be used in loco constraints. Takes as arguments: - A list of all the states - A list of all the transitions, in the form of vectors of [src dest input] - The initial state - A list of the final / accepting states Note that in Loco, all inputs to the state machine must be integers.
(map->automaton m initial-state final-states)A more idiomatic way to create automaton objects. Takes a map of {:state {<input> :new-state ...} ...}, as well as the initial state and final states.
A more idiomatic way to create automaton objects.
Takes a map of
{:state {<input> :new-state
...}
...},
as well as the initial state and final states.(minimize! a)(minimize! a algorithm)Mutates an automaton to have the minimal number of states necessary. Optionally specify what algorithm to use:
Mutates an automaton to have the minimal number of states necessary. Optionally specify what algorithm to use: - :hopcroft (O(n log n) algorithm) (default) - :huffman (O(n^2) algorithm) - :brzozowski (O(2^n) algorithm) If the input automaton is non-deterministic, minimize! will first have to "determinize" it (i.e. ensure only one transition per input character per state) which is an exponential-complexity operation.
(run a input)Good for testing state machines you've built before passing them to the constraint solver. Runs the automaton on an "input" of a collection of integers, and returns a boolean (true if the state machine parses the input and ends at a final state).
Good for testing state machines you've built before passing them to the constraint solver. Runs the automaton on an "input" of a collection of integers, and returns a boolean (true if the state machine parses the input and ends at a final state).
(string->automaton s)Takes a regular expression that parses a sequence of integers instead of characters. It has the following syntax:
Takes a regular expression that parses a sequence of integers instead of characters. It has the following syntax: - Any digit (0-9) parses that number. - An integer within angle-brackets (<12>) parses that integer. (careful, "12" without angle brackets parses 1, then 2.) - Special characters like ()[]|+*? work as expected. - Using letters, whitespace, or other non-digit non-special characters has unsupported, unintuitive behavior, and it is recommended that you avoid them.
(union A1 A2)Takes two automata A1 and A2, and returns a new automaton that accepts an input iff A1 or A2 would accept it.
Takes two automata A1 and A2, and returns a new automaton that accepts an input iff A1 or A2 would accept it.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |