This is a port of the reactive-core library for Scala into SuperCollider.
For more info see:
http://www.reactive-web.co.cc/core/EventStream
The combinators interface is essentialy a copy of reactive-banana Haskell library.
EventSource is an instance of the Functor and Monoid Type Classes.
EventStream[A]
Zero of Monoid Type Class. Returns an event source that never fires.
Methods to combine EventSource's into a network of event processing nodes. These combinators should be used inside an ENdef or NNdef.
initialValue |
The current ('now') value for the returned FPSignal. |
An FPSignal that holds the last value of the EventSource
A new EventStream, that for every event that this EventStream fires, that one will fire an event that is the result of applying 'f' to this EventStream's event.
A new EventStream that propagates a subset of the events that this EventStream fires.
initial |
initialValue |
f |
state altering function |
A new EventStream that, for every event t fired by the original EventStream, fires the result of the application of f (which will also be the next value of u passed to it). Often 'u' will be an object representing some accumulated state.
Allows one, in a functional manner, to respond to an event while taking into account past events. For every event t, f is called with arguments (u, t), where u is initially the value of the 'initial' parameter, and subsequently the result of the previous application of f.
initial |
initialValue |
f |
state altering function |
A new EventStream that, for every event t fired by the original EventStream, fires the result of the application of f (which will also be the next value of u passed to it). Often 'u' will be an object representing some accumulated state.
Creates a signal initialized with the initial state.
initial |
initial value |
A new EventStream that, for every event f fired by the original EventStream, fires the result of the application of f to the current state s.
initial |
initial value |
A new EventStream that, for every event f fired by the original EventStream, fires the result of the application of f to the current state s. Creates a signal initialized with the initial state.
Merges the output of the two EventSources.
the same as |+|
Create a new EventStream that consists of the events of the EventStreams returned by f. f is applied on every event of the original EventStream, and its returned EventStream is used until the next event fired by the original EventStream, at which time the previously returned EventStream is no longer used and a new one is used instead.
f |
f the function that is applied for every event to produce the next segment of the resulting EventStream. |
initES |
the initial EventStream to use. |
Map value with spec
Block values which are equal to the last value.
nil
This EventStream should carry values of class IO with actions to be performed. This method should be called when defining an EventNetwork with the monadic interface.
This EventStream should carry values of class IO with actions to be performed. This method should be called when defining an EventNetwork with the monadic interface.
Post incoming values to the post window with label.
When doing proper FRP (i.e. using ENdef or NNdef) these methods should not be used.
Emit an event to all registered listeners. This will send an event into the event processing network.
Run f every time a new event arrives.
f |
A function |
Unit
Stop running function f.
f |
A function |
Unit
Run f every time a new event arrives and save the function using the name given
name |
A key |
f |
The function to call |
Unit
Disconnects this EventStream from the parent EventStream (if it has a parent). If the EventStream is not assigned to any variable anymore it will be gc'ed.
Removes all listeners. This will disconnect this EventSource from the rest of the chain that depends on it, and the rest of the chain will be gc'ed.