sum package:vector

O(n) Compute the sum of the elements.

Examples

>>> import qualified Data.Vector as V

>>> V.sum $ V.fromList [300,20,1]
321

>>> V.sum (V.empty :: V.Vector Int)
0
O(n) Compute the sum of the elements.

Examples

>>> import qualified Data.Vector.Strict as V

>>> V.sum $ V.fromList [300,20,1]
321

>>> V.sum (V.empty :: V.Vector Int)
0
O(n) Compute the sum of the elements.

Examples

>>> import qualified Data.Vector.Primitive as VP

>>> VP.sum $ VP.fromList [300,20,1 :: Int]
321

>>> VP.sum (VP.empty :: VP.Vector Int)
0
O(n) Compute the sum of the elements.

Examples

>>> import qualified Data.Vector.Storable as VS

>>> VS.sum $ VS.fromList [300,20,1 :: Int]
321

>>> VS.sum (VS.empty :: VS.Vector Int)
0
O(n) Compute the sum of the elements.

Examples

>>> import qualified Data.Vector.Unboxed as VU

>>> VU.sum $ VU.fromList [300,20,1 :: Int]
321

>>> VU.sum (VU.empty :: VU.Vector Int)
0