UselessMachine (Journey v0.10.36)

This module (lib/examples/useless_machines.ex) contains an example of building a Useless Machine using Journey.

Here is an example of running the useless Machine:

iex> graph = UselessMachine.graph()
iex> execution = Journey.start_execution(graph)
iex> Journey.get_value(execution, :switch)
{:error, :not_set}
iex> Journey.get_value(execution, :paw)
{:error, :not_set}
iex> Journey.set(execution, :switch, "on")
iex> # updating switch triggers :paw
iex> {:ok, "updated :switch"} = Journey.get_value(execution, :paw, wait: :any)
iex> # :paw set switch back to "off"
iex> {:ok, "off"} = Journey.get_value(execution, :switch, wait: :any)

Summary

Functions

This function defines the graph for the Useless Machine. It starts with a switch input and mutates the state to "off" when the switch is toggled, simulating the behavior of a Useless Machine.

This function simulates the paw's response when the switch is toggled. It prints a message and mutates the state of the :switch node to "off".

Functions

graph()

This function defines the graph for the Useless Machine. It starts with a switch input and mutates the state to "off" when the switch is toggled, simulating the behavior of a Useless Machine.

lol_no(map)

This function simulates the paw's response when the switch is toggled. It prints a message and mutates the state of the :switch node to "off".