

(side-effects state event) is called with the resulting state and the event which just arrived, but will be called only once per event, and can be impure. (add state event) is called every time an event arrives to combine the event and the state together, returning some new state. Reset will be invoked with nil when no previous state exists. Reset must be a pure function, as it will be invoked in a compare-and-set loop. (reset previous-state) Given the state for the previous window, returns a fresh state for a new window. Returns a stream, composed of four functions: Therefore, this macro binds exception-stream twice: one when evaluating children, and again, every time the returned stream is invoked.ĭivides wall clock time into discrete windows. Then (rate), when invoked, might need access to this variable immediately. at the invocation time of exceptions itself. This is a little more complex than you might think, because we not only need to bind this variable during the runtime execution of child streams, but also during the evaluation of the child streams themselves, e.g. when using an executor or Thread), you must use (bound-fn) to preserve this binding. When call-rescue encounters an exception, it will also route the error to this exception stream. Call-rescue will rescue any exception thrown by a child stream, log it, and move on to the next child stream, so that a failure in one child won’t prevent others from executing.Įxceptions binds a dynamically scoped thread-local variable exception-stream. Streams often take multiple children and send an event to each using call-rescue.

Catches exceptions, converts them to events, and sends those events to a special exception stream.
