Functions and types for functional reactive programming.
(accum init stream)
Change an initial value based on an event stream of functions.
(behavior & form)
Takes a body of expressions and yields a behavior object that will evaluate
the body each time it is dereferenced.
Takes a zero-argument function and yields a Behavior object that will
evaluate the function each time it is dereferenced. See: behavior.
Return true if the object is a behavior.
Box a value to ensure it can be sent through a channel.
(buffer n stream)
Buffer all the events in the stream. A maximum buffer size may be specified,
in which case the buffer will contain only the last n items. It's recommended
that a buffer size is specified, otherwise the buffer will grow without limit.
True if the signal's value will no longer change.
Wraps x to guarantee that it will be the last value in a behavior or event
stream. The value of x will be cached, and any values after x will be
(constantly value stream)
Constantly map the same value over an event stream.
Return an accumulating count of the items in a stream.
(cycle values stream)
Incoming events cycle a sequence of values. Useful for switching between
(deliver stream & msgs)
Deliver one or more messages to an event stream.
Return a behavior that tracks the time in seconds from when it was created.
Clean up any resources an object has before it goes out of scope. In
Clojure this is called automatically when the object is finalized. In
ClojureScript this must be called manually.
Create a referential stream of events. An initial value may optionally be
supplied, otherwise the stream will be unrealized until the first value is
pushed to it. Event streams will deref to the latest value pushed to the
Return true if the object is a stream of events.
(filter pred stream)
Filter a stream by a predicate.
Flatten a stream of streams into a stream that contains all the values of
(join & streams)
Join several streams together. Events are delivered from the first stream
until it is completed, then the next stream, until all streams are complete.
(listen ob ch)
Add a listener channel to the observable. The channel will be closed
when the port of the observable is closed. Returns the channel.
Any events sent to the channel will be boxed to protect the channel from
nils. To listen for unboxed events, use subscribe.
(map f & streams)
Map a function over a stream.
(mapcat f stream)
(mapcat f stream & streams)
Mapcat a function over a stream.
(merge & streams)
Combine multiple streams into one. All events from the input streams are
pushed to the returned stream.
(on-dispose x f)
Add a function to be called when the object is disposed.
Create a completed event stream for a single value.
Return a write-only core.async channel. Any elements send to the port will
be distributed to the listener channels in parallel. Each listener must
accept before the next item is distributed.
(reduce f stream)
(reduce f init stream)
Create a new stream by applying a function to the previous return value and
the current value of the source stream.
(remove pred stream)
Remove all items in a stream the predicate matches.
(sample interval-ms reference)
Turn a reference into an event stream by deref-ing it at fixed intervals.
The interval time is specified in milliseconds.
True if the object is a behavior or event stream.
(subscribe stream channel)
Deliver events on an event stream to a core.async channel. Returns the
The events from the stream cannot include nil. The channel will be closed when
the event stream is complete.
(throttle timeout-ms stream)
Remove any events in a stream that occur too soon after the prior event.
The timeout is specified in milliseconds.
A behavior that tracks the current time in seconds.
Unbox a boxed value.
Remove any successive duplicates from the stream.
Returns a channel that will complete unrealized after specified number of
(zip & streams)
Combine multiple streams into one. On an event from any input stream, a
vector will be pushed to the returned stream containing the latest events
of all input streams.