Table of contents
Collapse the table of content
Expand the table of content

Observable.scan<'U,'T> Function (F#)

Den Delimarsky|Last Updated: 8/18/2017
1 Contributor

Returns an observable which, for each observer, allocates an item of state and applies the given accumulating function to successive values arising from the input. The returned object will trigger observations for each computed state value, excluding the initial value. The returned object propagates all errors arising from the source and completes when the source completes.

Namespace/Module Path: Microsoft.FSharp.Control.Observable

Assembly: FSharp.Core (in FSharp.Core.dll)


// Signature:
Observable.scan : ('U -> 'T -> 'U) -> 'U -> IObservable<'T> -> IObservable<'U>

// Usage:
Observable.scan collector state source


collector Type: 'U -> 'T -> 'U

The function to update the state with each observation.

state Type: 'U

The initial state.

source Type: IObservable<'T>

The input Observable.

Return Value

An observable that triggers on the updated state values.


For each observer, the registered intermediate observing object is not thread safe. That is, observations arising from the source must not be triggered concurrently on different threads.

This function is named Scan in compiled assemblies. If you are accessing the function from a language other than F#, or through reflection, use this name.


Windows 8, Windows 7, Windows Server 2012, Windows Server 2008 R2

Version Information

F# Core Library Versions

Supported in: 2.0, 4.0, Portable

See Also

Control.Observable Module (F#)

Microsoft.FSharp.Control Namespace (F#)

© 2019 Microsoft