Perform a left-associative fold over the arguments
$mac
is a reference to a macro, $base
is a mandatory base case followed
by a variable number of extra arguments to fold.
reduce!(m, a1, a2, b3, a4, a5)
// Expands to
m!(m!(m!(m!(a1, a2), a3), a4), a5)
Example
use std::macros::reduce;
macro plus($a, $b) {
$a + $b
}
assert_eq!(reduce!(plus, 0, 1, 2, 3, 4, 5), 15);
Run this example