You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But be aware that their value in Python and other similar languages is that they rely heavily on the implementation using generators (yield) to make them efficient, as otherwise, they grow literally exponentially and could explode the memory in places where JS usually run which aren't optimized for memory-heavy computations like the browser and the edge.
Remeda has a notion of "iterator"-like API using our lazy evaluation mechanism, but it only works in pipes. This could trip users who use these methods naively in their dataFirst variant and we should avoid those situations:
for(const[a,b]ofproduct(<BIG_ARRAY>,<BIG_ARRAY>)){// The whole product array is first computed and loaded into memory// before an iterator over it is created by the engine...// Probably not what the user thought would happen}
Related, but separate proposals:
product
, likexprod
from Ramda,itertools.product
from Python,std::ranges::cartesian_product_view
from C++,itertools::Iterator::cartesian_product
from Rust, requested in Lodash.zip
, or variadic? It could be strictly typed too.permutations
, likepermutations
from Deno std,itertools.permutations
from Python,itertools::Iterator::permutations
from Rust, similar tostd::next_permutation
from C++, requested in Lodash.combinations
, likeitertools.combinations
from Python,itertools::Iterator::combinations
from Rust, requested in Lodash.The text was updated successfully, but these errors were encountered: