Skip to content

How does this work with multiple generators? #8

Open
@tabatkins

Description

@tabatkins

The introduction of a generator into the pipeline implicitly invokes some looping, producing a generator as output. But what happens when you pipeline together two generators?

Like, say you have:

function* range(n) { for(const i = 0; i < n; i++) yield n; }
function* fbb(n) { yield "foo"+n; yield "bar"+n; yield "baz"+n; }

const what = range +> fbb +> (x=>console.log(x));
what(5); // what happens?

Does this implicitly loop twice, calling the final function 15 times in total?

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