Hi guys,
Is it possible to implement foldmap function for Iterator?
Like this:
fn funny(v: Vec<i32>) -> Vec<i32> {
v.iter()
.foldmap(0, |acc, x| acc + x)
.collect()
}
which is equals to :
fn funny(v: Vec<i32>) -> Vec<i32> {
let mut total = 0;
v.iter()
.map(|x| {total = total + x; total})
.collect()
}
Thanks.
Hi guys,
Is it possible to implement foldmap function for Iterator?
Like this:
which is equals to :
Thanks.