In Python:
sum(range(10))
In Rust: Vec![1..10].iter().reduce(|x,y| x+y) sum(range(10))
In Rust: Vec![1..10].iter().reduce(|x,y| x+y) sum(1..10)
(1..10).sum
or just sum 1..10You can use any infix op (core or custom) to do a reduction:
[*] 1..10 # 3628800 basically faculty