[−][src]Macro iter_comprehensions::product
A product expression.
The two possible macro calls
product!(EXPR; i1 in RANGE1, COND2, ..., ik in RANGEk)
product!(i1 in RANGE1, COND2, ..., ik in RANGEk, EXPR)
are roughly equivalent to
map!(EXPR; i1 in RANGE1, COND2, ..., ik in RANGEk).product()
map!(i1 in RANGE1, COND2, ..., ik in RANGEk, EXPR).product()
Example
The following expression corresponds to the mathematical expression $\prod_{i=1}^5 i$.
use iter_comprehensions::product; assert_eq!(product!(i in 1..=5, i), 120); assert_eq!(product!(i; i in 1..=5), 120);
It is also possible to specify the return type of the product in case it cannot be infered automatically.
use iter_comprehensions::product; assert_eq!(product!(usize : i; i in 1..=5), 120);