apply Events
fun <STATE, EVENT> applyEvents(stateEvolver: Evolver<EVENT, STATE>, initialState: STATE?, eventStream: List<EVENT>): STATE
Perform a left-fold over the eventStream using the initialState as the initial state
Return
the initial state with all events applied to it
Parameters
state Evolver
the state evolver (that applies events to the state)
initial State
the initial state provided to the state evolver
event Stream
the stream of Events supplied one by one (in-order) to the state evolver
EVENT
The type of Events that can be applied in the .applyEvent
STATE
The type of aggregate/projection/view STATE that .applyEvent supports