Header menu logo Nu

Stream Module

Stream operators.

Functions and values

Function or value Description

append streamL streamR

Full Usage: append streamL streamR

Parameters:
Returns: Stream<'a>
Modifiers: inline
Type parameters: 'a

Append a stream.

streamL : Stream<'a>
streamR : Stream<'a>
Returns: Stream<'a>

average stream

Full Usage: average stream

Parameters:
Returns: Stream<^a>
Modifiers: inline
Type parameters: ^a, ^a, ^b, ^c

Transform a stream into a running average of its event's numeric data.

stream : Stream<^a>
Returns: Stream<^a>

choose stream

Full Usage: choose stream

Parameters:
Returns: Stream<'a>

Filter out the None data values from a stream and strip the Some constructor from the remaining values.

stream : Stream<'a option>
Returns: Stream<'a>

definitize stream

Full Usage: definitize stream

Parameters:
Returns: Stream<'a>

Filter a stream of options for actual values.

stream : Stream<'a option>
Returns: Stream<'a>

distinct stream

Full Usage: distinct stream

Parameters:
Returns: Stream<'a * 'a>

Filter out the events with non-unique data from a stream.

stream : Stream<'a>
Returns: Stream<'a * 'a>

distinctBy by stream

Full Usage: distinctBy by stream

Parameters:
    by : 'a -> 'b
    stream : Stream<'a>

Returns: Stream<'a * 'b>

Filter out the events with non-unique data as defined via 'by' from a stream.

by : 'a -> 'b
stream : Stream<'a>
Returns: Stream<'a * 'b>

duplicate stream

Full Usage: duplicate stream

Parameters:
Returns: Stream<'a * 'a>

Transform a stream by duplicating its data into pairs.

stream : Stream<'a>
Returns: Stream<'a * 'a>

during pred stream

Full Usage: during pred stream

Parameters:
Returns: Stream<'a>

Take events from a stream while predicate is true.

pred : World -> bool
stream : Stream<'a>
Returns: Stream<'a>

filter pred stream

Full Usage: filter pred stream

Parameters:
    pred : 'a -> bool
    stream : Stream<'a>

Returns: Stream<'a>

Filter a stream by the given 'pred' procedure.

pred : 'a -> bool
stream : Stream<'a>
Returns: Stream<'a>

filterLeft stream

Full Usage: filterLeft stream

Parameters:
Returns: Stream<'a>
Modifiers: inline
Type parameters: 'a, 'b

Filter the left values out from the stream.

stream : Stream<Either<'a, 'b>>
Returns: Stream<'a>

filterPlus pred stream

Full Usage: filterPlus pred stream

Parameters:
Returns: Stream<'a>

Filter a stream by the given 'pred' procedure.

pred : Event<'a, Simulant> -> World -> bool
stream : Stream<'a>
Returns: Stream<'a>

filterRight stream

Full Usage: filterRight stream

Parameters:
Returns: Stream<'b>
Modifiers: inline
Type parameters: 'a, 'b

Filter the right values out from the stream.

stream : Stream<Either<'a, 'b>>
Returns: Stream<'b>

first stream

Full Usage: first stream

Parameters:
Returns: Stream<'a>

Transform a stream of pairs into its fst values.

stream : Stream<'a * 'b>
Returns: Stream<'a>

fold f s stream

Full Usage: fold f s stream

Parameters:
    f : 'b -> 'a -> 'b
    s : 'b
    stream : Stream<'a>

Returns: Stream<'b>

Fold over a stream, aggegating the result.

f : 'b -> 'a -> 'b
s : 'b
stream : Stream<'a>
Returns: Stream<'b>

foldPlus f s stream

Full Usage: foldPlus f s stream

Parameters:
Returns: Stream<'b>

Fold over a stream, aggegating the result.

f : 'b -> Event<'a, Simulant> -> World -> 'b
s : 'b
stream : Stream<'a>
Returns: Stream<'b>

foldThen f g s stream

Full Usage: foldThen f g s stream

Parameters:
    f : 'b -> 'a -> 'b
    g : 'b -> 'c
    s : 'b
    stream : Stream<'a>

Returns: Stream<'c>
f : 'b -> 'a -> 'b
g : 'b -> 'c
s : 'b
stream : Stream<'a>
Returns: Stream<'c>

foldThenPlus f g s stream

Full Usage: foldThenPlus f g s stream

Parameters:
Returns: Stream<'c>

Fold over a stream, then map the result.

f : 'b -> Event<'a, Simulant> -> World -> 'b
g : 'b -> 'c
s : 'b
stream : Stream<'a>
Returns: Stream<'c>

generalize stream

Full Usage: generalize stream

Parameters:
Returns: Stream<obj>

Generalize a stream's data type to obj.

stream : Stream<'a>
Returns: Stream<obj>

group stream

Full Usage: group stream

Parameters:
Returns: Stream<'a * bool * Set<'a>>

Transform a stream into a running set of its event's unique data.

stream : Stream<'a>
Returns: Stream<'a * bool * Set<'a>>

groupBy by stream

Full Usage: groupBy by stream

Parameters:
    by : 'a -> 'b
    stream : Stream<'a>

Returns: Stream<'b * bool * Set<'b>>

Transform a stream into a running set of its event's unique data as defined via 'by'.

by : 'a -> 'b
stream : Stream<'a>
Returns: Stream<'b * bool * Set<'b>>

head stream

Full Usage: head stream

Parameters:
Returns: Stream<'a>

Take only the first event from a stream.

stream : Stream<'a>
Returns: Stream<'a>

id stream

Full Usage: id stream

Parameters:
Returns: Stream<'a>

Identity for streams.

stream : Stream<'a>
Returns: Stream<'a>

insert state stream

Full Usage: insert state stream

Parameters:
    state : 'a
    stream : Stream<'b>

Returns: Stream<'a * 'b>

Insert a persistent state value into the stream.

state : 'a
stream : Stream<'b>
Returns: Stream<'a * 'b>

lifetime subscriber stream_

Full Usage: lifetime subscriber stream_

Parameters:
    subscriber : 's
    stream_ : Stream<'a>

Returns: Stream<'a>

Terminate a stream when the subscriber is unregistered from the world.

subscriber : 's
stream_ : Stream<'a>
Returns: Stream<'a>

make eventAddress

Full Usage: make eventAddress

Parameters:
Returns: Stream<'a>

Make a stream of an event at the given address.

eventAddress : 'a Address
Returns: Stream<'a>

map mapper stream

Full Usage: map mapper stream

Parameters:
    mapper : 'a -> 'b
    stream : Stream<'a>

Returns: Stream<'b>

Map over a stream by the given 'mapper' procedure.

mapper : 'a -> 'b
stream : Stream<'a>
Returns: Stream<'b>

map2 mapper stream stream2

Full Usage: map2 mapper stream stream2

Parameters:
    mapper : 'a -> 'b -> 'c
    stream : Stream<'a>
    stream2 : Stream<'b>

Returns: Stream<'c>

Map over two streams by the given 'mapper' procedure.

mapper : 'a -> 'b -> 'c
stream : Stream<'a>
stream2 : Stream<'b>
Returns: Stream<'c>

map2Plus mapper stream stream2

Full Usage: map2Plus mapper stream stream2

Parameters:
Returns: Stream<'c>

Map over two streams.

mapper : Event<'a, Simulant> -> Event<'b, Simulant> -> World -> 'c
stream : Stream<'a>
stream2 : Stream<'b>
Returns: Stream<'c>

mapFirst mapper stream

Full Usage: mapFirst mapper stream

Parameters:
    mapper : 'a -> 'b
    stream : Stream<'a * 'c>

Returns: Stream<'b * 'c>

Transform a stream's pairs by a mapping of its fst values.

mapper : 'a -> 'b
stream : Stream<'a * 'c>
Returns: Stream<'b * 'c>

mapPlus mapper stream

Full Usage: mapPlus mapper stream

Parameters:
Returns: Stream<'b>

Map over a stream by the given 'mapper' procedure.

mapper : Event<'a, Simulant> -> World -> 'b
stream : Stream<'a>
Returns: Stream<'b>

mapSecond mapper stream

Full Usage: mapSecond mapper stream

Parameters:
    mapper : 'a -> 'b
    stream : Stream<'c * 'a>

Returns: Stream<'c * 'b>

Transform a stream of pairs by a mapping of its snd values.

mapper : 'a -> 'b
stream : Stream<'c * 'a>
Returns: Stream<'c * 'b>

max stream

Full Usage: max stream

Parameters:
Returns: Stream<'a>

Transform a stream into a running maximum of it numeric data.

stream : Stream<'a>
Returns: Stream<'a>

min stream

Full Usage: min stream

Parameters:
Returns: Stream<'a>

Transform a stream into a running minimum of it numeric data.

stream : Stream<'a>
Returns: Stream<'a>

monitor callback subscriber stream world

Full Usage: monitor callback subscriber stream world

Parameters:

Subscribe to a stream until the subscriber is removed from the world.

callback : Event<'a, 'b> -> World -> unit
subscriber : 'b
stream : Stream<'a>
world : World

monitorEffect callback subscriber stream world

Full Usage: monitorEffect callback subscriber stream world

Parameters:
Returns: World -> unit

Subscribe to a stream until the subscriber is removed from the world, returning both an unsubscription procedure as well as the world as augmented with said callback.

callback : Event<'a, 'b> -> World -> Handling
subscriber : 'b
stream : Stream<'a>
world : World
Returns: World -> unit

nth n stream

Full Usage: nth n stream

Parameters:
Returns: Stream<'a>

Take only the nth event from a stream.

n : int
stream : Stream<'a>
Returns: Stream<'a>

optimize stream

Full Usage: optimize stream

Parameters:
Returns: Stream<'a>

Filter events with unchanging data.

stream : Stream<'a>
Returns: Stream<'a>

optimizeBy by stream

Full Usage: optimizeBy by stream

Parameters:
    by : 'a -> 'b
    stream : Stream<'a>

Returns: Stream<'a>

Filter events with unchanging data.

by : 'a -> 'b
stream : Stream<'a>
Returns: Stream<'a>

organize f stream

Full Usage: organize f stream

Parameters:
    f : 'a -> 'b
    stream : Stream<'a>

Returns: Stream<('a * 'b) option * Map<'b, 'a>>

Transform a stream into a running map from its event's data to keys as defined by 'f'.

f : 'a -> 'b
stream : Stream<'a>
Returns: Stream<('a * 'b) option * Map<'b, 'a>>

product stream stream2

Full Usage: product stream stream2

Parameters:
Returns: Stream<'a * 'b>

Combine two streams. Combination is in 'product form', which is defined as a pair of the data of the combined events. Think of it as 'zip' for event streams.

stream : Stream<'a>
stream2 : Stream<'b>
Returns: Stream<'a * 'b>

productN stream

Full Usage: productN stream

Parameters:
Returns: Stream<^a>
Modifiers: inline
Type parameters: ^a

Transform a stream into a running product of its data.

stream : Stream<^a>
Returns: Stream<^a>

reduce f stream

Full Usage: reduce f stream

Parameters:
    f : 'a -> 'a -> 'a
    stream : Stream<'a>

Returns: Stream<'a>

Reduce over a stream, accumulating the result.

f : 'a -> 'a -> 'a
stream : Stream<'a>
Returns: Stream<'a>

reducePlus f stream

Full Usage: reducePlus f stream

Parameters:
Returns: Stream<'a>

Reduce over a stream, accumulating the result.

f : 'a -> Event<'a, Simulant> -> World -> 'a
stream : Stream<'a>
Returns: Stream<'a>

search p stream

Full Usage: search p stream

Parameters:
    p : 'a -> bool
    stream : Stream<'a>

Returns: Stream<'a>

Take only the first event from a stream that satisfies 'p'.

p : 'a -> bool
stream : Stream<'a>
Returns: Stream<'a>

second stream

Full Usage: second stream

Parameters:
Returns: Stream<'b>

Transform a stream of pairs into its snd values.

stream : Stream<'a * 'b>
Returns: Stream<'b>

sense callback entity facet stream world

Full Usage: sense callback entity facet stream world

Parameters:

Subscribe to a stream for the life span of an entity and a given facet.

callback : Event<'a, Entity> -> World -> unit
entity : Entity
facet : string
stream : Stream<'a>
world : World

senseEffect callback entity facetName stream world

Full Usage: senseEffect callback entity facetName stream world

Parameters:
Returns: World -> unit

Subscribe to a stream for the life span of an entity and a given facet.

callback : Event<'a, Entity> -> World -> Handling
entity : Entity
facetName : string
stream : Stream<'a>
world : World
Returns: World -> unit

skip n stream

Full Usage: skip n stream

Parameters:
Returns: Stream<'a>

Skip the first n events in a stream.

n : int
stream : Stream<'a>
Returns: Stream<'a>

subscribe callback subscriber stream world

Full Usage: subscribe callback subscriber stream world

Parameters:

Subscribe to a stream, handling each event with the given callback.

callback : Event<'a, 'b> -> World -> unit
subscriber : 'b
stream : Stream<'a>
world : World

subscribeEffect callback subscriber stream world

Full Usage: subscribeEffect callback subscriber stream world

Parameters:
Returns: World -> unit

Subscribe to a stream, handling each event with the given callback, returning both an unsubscription procedure as well as the world as augmented with said callback.

callback : Event<'a, 's> -> World -> Handling
subscriber : 's
stream : Stream<'a>
world : World
Returns: World -> unit

sum stream stream2

Full Usage: sum stream stream2

Parameters:
Returns: Stream<Either<'a, 'b>>

Combine two streams. Combination is in 'sum form', which is defined as an Either of the data of the combined events, where only data from the most recent event is available at a time.

stream : Stream<'a>
stream2 : Stream<'b>
Returns: Stream<Either<'a, 'b>>

sumN stream

Full Usage: sumN stream

Parameters:
Returns: Stream<^a>
Modifiers: inline
Type parameters: ^a

Transform a stream into a running sum of its data.

stream : Stream<^a>
Returns: Stream<^a>

tail stream

Full Usage: tail stream

Parameters:
Returns: Stream<'a>

Skip the first event of a stream.

stream : Stream<'a>
Returns: Stream<'a>

take n stream

Full Usage: take n stream

Parameters:
Returns: Stream<'a>

Take only the first n events from a stream.

n : int
stream : Stream<'a>
Returns: Stream<'a>

track tracker state stream

Full Usage: track tracker state stream

Parameters:
    tracker : 'b -> 'b * bool
    state : 'b
    stream : Stream<'a>

Returns: Stream<'a>
tracker : 'b -> 'b * bool
state : 'b
stream : Stream<'a>
Returns: Stream<'a>

track2 tracker stream

Full Usage: track2 tracker stream

Parameters:
    tracker : 'a -> 'a -> 'a * bool
    stream : Stream<'a>

Returns: Stream<'a>
tracker : 'a -> 'a -> 'a * bool
stream : Stream<'a>
Returns: Stream<'a>

track4 tracker transformer state stream

Full Usage: track4 tracker transformer state stream

Parameters:
    tracker : 'c -> 'a -> 'c * bool
    transformer : 'c -> 'b
    state : 'c
    stream : Stream<'a>

Returns: Stream<'b>
tracker : 'c -> 'a -> 'c * bool
transformer : 'c -> 'b
state : 'c
stream : Stream<'a>
Returns: Stream<'b>

trackPlus tracker state stream

Full Usage: trackPlus tracker state stream

Parameters:
    tracker : 'b -> World -> 'b * bool
    state : 'b
    stream : Stream<'a>

Returns: Stream<'a>

Tracks changes using a stateful tracker function and creates a stream that optionally processes events based on the state.

tracker : 'b -> World -> 'b * bool
state : 'b
stream : Stream<'a>
Returns: Stream<'a>

trackPlus2 tracker stream

Full Usage: trackPlus2 tracker stream

Parameters:
Returns: Stream<'a>

Tracks changes in a stream using a stateful tracker function and produces a new stream with updated values.

tracker : 'a -> Event<'a, Simulant> -> World -> 'a * bool
stream : Stream<'a>
Returns: Stream<'a>

trackPlus4 tracker transformer state stream

Full Usage: trackPlus4 tracker transformer state stream

Parameters:
Returns: Stream<'b>

Track changes in a stream using a stateful tracker function, transforms the tracked state, and produces a new stream with the transformed values.

tracker : 'c -> Event<'a, Simulant> -> World -> 'c * bool
transformer : 'c -> 'b
state : 'c
stream : Stream<'a>
Returns: Stream<'b>

until stream stream2

Full Usage: until stream stream2

Parameters:
Returns: Stream<'a>

Terminate a stream when a given stream receives a value.

stream : Stream<'b>
stream2 : Stream<'a>
Returns: Stream<'a>

whenAdvancing stream

Full Usage: whenAdvancing stream

Parameters:
Returns: Stream<'a>

Take events from a stream only when World.getAdvancing evaluates to true.

stream : Stream<'a>
Returns: Stream<'a>

whenHalted stream

Full Usage: whenHalted stream

Parameters:
Returns: Stream<'a>

Take events from a stream only when World.getHalted evaluates to true.

stream : Stream<'a>
Returns: Stream<'a>

whenSelected simulant stream

Full Usage: whenSelected simulant stream

Parameters:
Returns: Stream<'a>

Take events from a stream only when the simulant is contained by, or is the same as, the currently selected screen. Game is always considered 'selected' as well.

simulant : Simulant
stream : Stream<'a>
Returns: Stream<'a>

whenSelectedScreenIdling stream

Full Usage: whenSelectedScreenIdling stream

Parameters:
Returns: Stream<'a>

Take events from a stream only when the currently selected screen is idling (that is, there is no screen transition in progress).

stream : Stream<'a>
Returns: Stream<'a>

whenSelectedScreenTransitioning stream

Full Usage: whenSelectedScreenTransitioning stream

Parameters:
Returns: Stream<'a>

Take events from a stream only when the currently selected screen is transitioning (that is, there is a screen transition in progress).

stream : Stream<'a>
Returns: Stream<'a>

Type something to start searching.