Find Index operator

Rocket.find_indexFunction
find_index(conditionFn::F) where { F <: Function }

Creates a find operator, which emits only the index of the first value emitted by the source Observable that meets some condition. Indices are 1-based.

Producing

Stream of type <: Subscribable{L} where L refers to type of source stream

Arguments

  • conditionFn::F: condition function with (data::T) -> Bool signature

Examples

using Rocket

source = from([ 0, 1, 2, 3, 4, 5, 6, 7, 8 ])
subscribe!(source |> find_index((d) -> d !== 0 && d % 2 == 0), logger())
;

# output

[LogActor] Data: 3
[LogActor] Completed

See also: find, AbstractOperator, InferableOperator, ProxyObservable, logger

source

Description

It's like find, but emits the index of the found value, not the value itself.

See also

Operators, take