import { product } from "https://deno.land/x/iter@v3.2.3/lib/reducers.ts";
- Finds the product of all items in
it
. -
warning: When ran on an endless iterable without any zeros, this never returns.
Examples
Example 1
Example 1
import * as iter from "https://deno.land/x/iter";
const myRange = iter.create.range(1, 10);
console.log(iter.product(myRange)); // -> 3628800
// Demonstrating laziness
const rangeWithZero = iter.create.range(-1, 10);
const observerdIter = iter.lazyObserver(
rangeWithZero,
(x) => console.log("Processed: " + x),
);
// -> Processed: -1
// -> Processed: 0
console.log(iter.product(observerdIter)); // -> -0