diet v0.1.0 Diet.Stepper
Executes the reduction machine until it generates a terminating transition.
Before performing any work, you need to initialize a stepper, passing it the module containing the reductions and a state that the reductions can use:
stepper = Stepper.new(RunLengthEncode, nil)
You then run the machine, passing in any parameters you like. Conventionally, you’ll pass either an atom representing an event, or a tuple with an atom and some additional parameters.
{ result, updated_stepper } = Stepper.run(stepper, { :encode, "11123342111" }
Summary
Functions
Run the reduction machine, passing the initial trigger. The machine
will then return the result of reducing that. If the result
represents the conclusion of the machine’s work, it will return
{ :done, result, model }. We extract the result and the updated
model and return them in a tuple to the caller
Functions
Run the reduction machine, passing the initial trigger. The machine
will then return the result of reducing that. If the result
represents the conclusion of the machine’s work, it will return
{ :done, result, model }. We extract the result and the updated
model and return them in a tuple to the caller.