Map Operator

Base.mapFunction
map(::Type{R}, mappingFn::F) where { F <: Function }

Creates a map operator, which applies a given mappingFn to each value emmited by the source Observable, and emits the resulting values as an Observable. You have to specify output R type after mappingFn projection.

Arguments

  • ::Type{R}: the type of data of transformed value, may be or may not be the same as source type
  • mappingFn::Function: transformation function with (data::L) -> R signature, where L is type of data in input source

Producing

Stream of type <: Subscribable{R}

Examples

using Rocket

source = from([ 1, 2, 3 ])
subscribe!(source |> map(Int, (d) -> d ^ 2), logger())
;

# output

[LogActor] Data: 1
[LogActor] Data: 4
[LogActor] Data: 9
[LogActor] Completed

See also: AbstractOperator, RightTypedOperator, ProxyObservable, logger

source

Description

Like map(f, array), the map operator applies a function to each source value.

See also

Operators