maximum package:vector
O(n) Yield the maximum element of the vector. The vector may
not be empty. In case of a tie, the first occurrence wins.
Examples
>>> import qualified Data.Vector as V
>>> V.maximum $ V.fromList [2, 1]
2
>>> import Data.Semigroup
>>> V.maximum $ V.fromList [Arg 1 'a', Arg 2 'b']
Arg 2 'b'
>>> V.maximum $ V.fromList [Arg 1 'a', Arg 1 'b']
Arg 1 'a'
O(n) Yield the maximum element of the vector. The vector may
not be empty. In case of a tie, the first occurrence wins.
Examples
>>> import qualified Data.Vector.Strict as V
>>> V.maximum $ V.fromList [2, 1]
2
>>> import Data.Semigroup
>>> V.maximum $ V.fromList [Arg 1 'a', Arg 2 'b']
Arg 2 'b'
>>> V.maximum $ V.fromList [Arg 1 'a', Arg 1 'b']
Arg 1 'a'
O(n) Yield the maximum element of the vector. The vector may
not be empty. In case of a tie, the first occurrence wins.
Examples
>>> import qualified Data.Vector.Primitive as VP
>>> VP.maximum $ VP.fromList [2, 1 :: Int]
2
O(n) Yield the maximum element of the vector. The vector may
not be empty. In case of a tie, the first occurrence wins.
Examples
>>> import qualified Data.Vector.Storable as VS
>>> VS.maximum $ VS.fromList [2, 1 :: Int]
2
O(n) Yield the maximum element of the vector. The vector may
not be empty. In case of a tie, the first occurrence wins.
Examples
>>> import qualified Data.Vector.Unboxed as VU
>>> VU.maximum $ VU.fromList [2, 1 :: Int]
2
>>> import Data.Semigroup
>>> VU.maximum $ VU.fromList [Arg 1 'a', Arg (2 :: Int) 'b']
Arg 2 'b'
>>> VU.maximum $ VU.fromList [Arg 1 'a', Arg (1 :: Int) 'b']
Arg 1 'a'
O(n) Yield the maximum element of the vector according to the
given comparison function. The vector may not be empty. In case of a
tie, the first occurrence wins. This behavior is different from
maximumBy which returns the last tie.
Examples
>>> import Data.Ord
>>> import qualified Data.Vector as V
>>> V.maximumBy (comparing fst) $ V.fromList [(2,'a'), (1,'b')]
(2,'a')
>>> V.maximumBy (comparing fst) $ V.fromList [(1,'a'), (1,'b')]
(1,'a')
O(n) Yield the maximum element of the vector by comparing the
results of a key function on each element. In case of a tie, the first
occurrence wins. The vector may not be empty.
Examples
>>> import qualified Data.Vector as V
>>> V.maximumOn fst $ V.fromList [(2,'a'), (1,'b')]
(2,'a')
>>> V.maximumOn fst $ V.fromList [(1,'a'), (1,'b')]
(1,'a')
O(n) Yield the maximum element of the vector according to the
given comparison function. The vector may not be empty. In case of a
tie, the first occurrence wins. This behavior is different from
maximumBy which returns the last tie.
Examples
>>> import Data.Ord
>>> import qualified Data.Vector.Strict as V
>>> V.maximumBy (comparing fst) $ V.fromList [(2,'a'), (1,'b')]
(2,'a')
>>> V.maximumBy (comparing fst) $ V.fromList [(1,'a'), (1,'b')]
(1,'a')
O(n) Yield the maximum element of the vector by comparing the
results of a key function on each element. In case of a tie, the first
occurrence wins. The vector may not be empty.
Examples
>>> import qualified Data.Vector.Strict as V
>>> V.maximumOn fst $ V.fromList [(2,'a'), (1,'b')]
(2,'a')
>>> V.maximumOn fst $ V.fromList [(1,'a'), (1,'b')]
(1,'a')
O(n) Yield the maximum element of the vector according to the
given comparison function. The vector may not be empty. In case of a
tie, the first occurrence wins. This behavior is different from
maximumBy which returns the last tie.
O(n) Yield the maximum element of the vector by comparing the
results of a key function on each element. In case of a tie, the first
occurrence wins. The vector may not be empty.
O(n) Yield the maximum element of the vector according to the
given comparison function. The vector may not be empty. In case of a
tie, the first occurrence wins. This behavior is different from
maximumBy which returns the last tie.
O(n) Yield the maximum element of the vector by comparing the
results of a key function on each element. In case of a tie, the first
occurrence wins. The vector may not be empty.
O(n) Yield the maximum element of the vector according to the
given comparison function. The vector may not be empty. In case of a
tie, the first occurrence wins. This behavior is different from
maximumBy which returns the last tie.
Examples
>>> import Data.Ord
>>> import qualified Data.Vector.Unboxed as VU
>>> VU.maximumBy (comparing fst) $ VU.fromList [(2,'a'), (1 :: Int,'b')]
(2,'a')
>>> VU.maximumBy (comparing fst) $ VU.fromList [(1,'a'), (1 :: Int,'b')]
(1,'a')
O(n) Yield the maximum element of the vector by comparing the
results of a key function on each element. In case of a tie, the first
occurrence wins. The vector may not be empty.
Examples
>>> import qualified Data.Vector.Unboxed as VU
>>> VU.maximumOn fst $ VU.fromList [(2,'a'), (1 :: Int,'b')]
(2,'a')
>>> VU.maximumOn fst $ VU.fromList [(1,'a'), (1 :: Int,'b')]
(1,'a')