Skip to content

Fork/join and general parallelization? #36

@chadobado

Description

@chadobado

Curious how forking and joining might be accomplished with this library?

..similar to this.

Something like this looks really verbose (and isn't really parallel), so assuming there is a better way?

var processedBags = []

var transformFragile = compose(
    filter(x => x.bagType == 'fragile'),
    map(x => merge(x,{luggageTag: 'Handle with care'}))
);

var transformHeavy = compose(
    filter(x => x.bagType == 'heavy'),
    map(x => merge(x,{luggageTag: 'Watch your back!!'}))
);

var transformNormal = filter(x => x.bagType == 'normal')

processedBags = into(processedBags, transformFragile, bags)
processedBags = into(processedBags, transformHeavy, bags)
processedBags = into(processedBags, transformNormal, bags)

Also attempted other variations w/a switch statement inside a mapper. Also doesn't feel right.

Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions