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
Looking at how pub fn cartesian_product<I, J>(mut i: I, j: J) -> Product<I, J> initialises Product, one can see that it yields the first item in i.
Wouldn't it be better if Product.a_cur was an Option<Option<I::Item>> and initialized as None, rather than initializing it by starting the consumption of i?
This may cause problems if iteration over i has side effects.
Same with Product.b too. No reason to clone it ahead of time.
I haven't looked deep into at the implementation of multi_cartesian_product but it may be a similar situation there too.
The text was updated successfully, but these errors were encountered:
I agree, I came to the same conclusion and same "nested option" solution, implemented in #800. More about laziness in #791. It took a while but it's solved.
Wow, I have no idea what i could've needed this for back in 2018, but i might actually need it soon for something so... thanks for fixing it - good timing! 😆
Looking at how
pub fn cartesian_product<I, J>(mut i: I, j: J) -> Product<I, J>
initialisesProduct
, one can see that it yields the first item ini
.Wouldn't it be better if
Product.a_cur
was anOption<Option<I::Item>>
and initialized asNone
, rather than initializing it by starting the consumption ofi
?This may cause problems if iteration over
i
has side effects.Same with
Product.b
too. No reason to clone it ahead of time.I haven't looked deep into at the implementation of
multi_cartesian_product
but it may be a similar situation there too.The text was updated successfully, but these errors were encountered: