countBetween Int Int countBetween list if maxInd minInd then length dr

1
2
3
4
5
6
countBetween :: [Int] -> Int
countBetween list = if (maxInd > minInd)
then length (drop (fromJust minInd) (take (fromJust maxInd) list))
else length (drop (fromJust maxInd) (take (fromJust minInd) list)) * (-1)
where maxInd = elemIndex (foldl max int_min list) list
minInd = elemIndex (foldl min int_max list) list