September 2023
Intermediate to advanced
470 pages
11h 12m
English
The exercises in this chapter will focus on the functional finite state machine.
Here is your friendly reminder that nobody can learn functional programming by just reading code, and the best way to learn is by practicing. You can refer to the exercises folder in the book code repository for the starting point and some hints.
For this exercise, try to implement a simple state machine to represent an elevator. You need to define the commands and the states. Commands should represent user interaction, like the button to call the elevator and the ones inside the elevator to stop at some floor. States should be “Doors open at floor x” and “Traveling at floor y.” You shouldn’t use events ...
Read now
Unlock full access