Map Operator
Base.map — Functionmap(::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 typemappingFn::Function: transformation function with(data::L) -> Rsignature, 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] CompletedSee also: AbstractOperator, RightTypedOperator, ProxyObservable, logger
Description
Like map(f, array), the map operator applies a function to each source value.