OxL Reference

method iter.sum

Sum of the elements (pulls them all); panics on overflow like +.

Example:

oxl✓ checked in CI
fn main() io {
  let xs: List<isize> = [1, 2, 3, 4]
  print("{xs.iter().sum()}")
}
Output
10
pub(api) move fn sum() -> isize

Complexity. O(n); pulls every element.

Since. 1.0.0-beta

Returns

isize

Effects

none declared (pure unless the body says otherwise)

Defined in: std/core/iter_numbers.oxl:191

See also