How to represent a simple finite state machine in Ocaml?

后端 未结 4 1335
青春惊慌失措
青春惊慌失措 2021-02-04 08:24

I have written some state machine in C++ and Java but never in a functional language like Ocaml

Problem is I don\'t know if I can just adapt code from the object languag

4条回答
  •  伪装坚强ぢ
    2021-02-04 08:37

    There is an excellent answer which demonstrates expressiveness and elegance of OCaml in representing finite state machine here:

    automata in ocaml

    For more serious use, you could try to look at some finite state machine library like fsm library here.

提交回复
热议问题