avoid `sum` because it fails on empty arrays
docs