Pairwise Operator

Rocket.pairwiseFunction
pairwise([ initial ])

Creates a pairwise operator, which groups pairs of consecutive emissions together and emits them as a tuple of two values. Accepts optional initial seed value to start pairing from.

using Rocket

source = from(1:5) |> pairwise()

subscribe!(source, logger())
;

# output

[LogActor] Data: (1, 2)
[LogActor] Data: (2, 3)
[LogActor] Data: (3, 4)
[LogActor] Data: (4, 5)
[LogActor] Completed
using Rocket

source = from(1:5) |> pairwise(0)

subscribe!(source, logger())
;

# output

[LogActor] Data: (0, 1)
[LogActor] Data: (1, 2)
[LogActor] Data: (2, 3)
[LogActor] Data: (3, 4)
[LogActor] Data: (4, 5)
[LogActor] Completed

See also: AbstractOperator, InferableOperator, logger

source

See also

Operators