@@ -7,6 +7,7 @@ open FSharp.Control.R3
7
7
8
8
module Observable =
9
9
10
+ /// Maps the given observable with the given function
10
11
let mapAsync ( options : ProcessingOptions ) ( f : CancellationToken -> 't -> Task < 'r >) source =
11
12
let selector x ct = ValueTask< 'r> ( f ct x)
12
13
ObservableExtensions.SelectAwait (
@@ -20,10 +21,28 @@ module Observable =
20
21
21
22
let length cancellationToken source = ObservableExtensions.CountAsync ( source, cancellationToken)
22
23
24
+ /// Invokes an action for each element in the observable sequence, and propagates all observer
25
+ /// messages through the result sequence. This method can be used for debugging, logging, etc. of query
26
+ /// behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
23
27
let inline iter cancellationToken ( action : 't -> unit ) source = ObservableExtensions.ForEachAsync ( source, action, cancellationToken)
24
28
25
29
let iterAsync cancellationToken options ( action : CancellationToken -> 't -> Task < unit >) source =
26
30
source
27
31
|> mapAsync options action
28
32
|> length cancellationToken
29
33
:> Task
34
+
35
+ /// Applies an accumulator function over an observable sequence, returning the
36
+ /// result of the aggregation as a single element in the result sequence
37
+ let inline aggregateAsync cancellationToken seed ( f : 'r -> 't -> 'r ) source =
38
+ ObservableExtensions.AggregateAsync ( source, seed, f, cancellationToken)
39
+
40
+ /// Determines whether all elements of an observable satisfy a predicate
41
+ let inline allAsync cancellationToken ( f : 't -> bool ) source = ObservableExtensions.AllAsync ( source, f, cancellationToken)
42
+
43
+ /// Determines whether an observable sequence contains a specified value
44
+ /// which satisfies the given predicate
45
+ let inline existsAsync source = ObservableExtensions.AnyAsync source
46
+
47
+ /// Returns the first element of an observable sequence
48
+ let inline firstAsync source = ObservableExtensions.FirstAsync source
0 commit comments