javascript-allonge-six
javascript-allonge-six copied to clipboard
Composing and Decomposing Data: Functional Iterators: unfolding and laziness
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};
}