2
\$\begingroup\$

The state machine has the below specifications

    (defparameter *test-machine*
(make-fsm
:alphabet '(a b)
:table '((2 1) (0 2) (1 0))
:initial 0
:accepting '(2)))

The FSM in the function is:

 [1]> (fsm-alphabet *test-machine*)
(A B)
[2]> (fsm-initial *test-machine*)
0
[3]> (fsm-accepting *test-machine*)
(1)

The transition of the function is - the element of the alphabet of fsm the state index of the function is the index of the current state in the list of states

below is the function output

 [3]> (transition-function *test-machine* 0 'a)
2
[4]> (transition-function *test-machine* 0 'b)
1
[5]> (transition-function *test-machine* 2 'b)
0

the built-in function position will return the index of an element in a list if that element exists. For example, (position '3 '(1 2 0 2 3 5 6)) will return 4.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ do you still need help with this question? \$\endgroup\$
    – coredump
    Nov 20, 2020 at 17:11

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.