Is there a concept of range in Haskell or other functional programming languages? Suppose I want to compute I_AMAX from BLAS (to find the smallest index of the largest element in vector x). A naive method would be something like
idamax x idx = foldr(imax) 0 (zip x idx)
where idx is the index vector and imax returns the tuple with the smallest index and largest value.
For example, some vector (say, [1, 7, 3, 5]), zipped with its index vector ([0, 1, 2, 3], which makes [(1, 0), (7, 1), (3, 2), (5, 2)]), then reduced with the maximum function (so (7, 1), or 7).
But the index knowledge should be implicit, since in a loop the index is self-evident. Is there a way to write this in Haskell?
tl;dr, what's the best way to write I_AMAX in Haskell?