Skip to content

Composing and Decomposing Data: Functional Iterators: unfolding and laziness #43

Description

@fugalfunkster

The filterIteratorWith function on page 156 (pdf, 4/14/16) did not work for me. I believe the const declaration in the do block is the culprit. I got it to execute by making a let declaration for done and value before the do block:

 const filterIteratorWith = (fn, iterator) =>
    () => {
      let done, value;
      do {
        ({done, value} = iterator());
      } while (!done && !fn(value));
      return {done, value};
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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