vt-utils-1.3.0.0: Vector and Text utilities

Safe HaskellNone
LanguageHaskell2010

VtUtils.Vector

Description

Vector utilities

Synopsis

Documentation

vectorFirstDuplicate :: (Eq k, Hashable k) => Vector a -> (Int -> a -> k) -> Maybe (Int, Int) Source #

Finds the fist two elements which have the same key value for the specified key function

Arguments:

  • vec :: Vector a: Vector to search duplicate in
  • keyfun :: (Int -> a -> k) Key function, takes index and element as an input

Return value: two indices pointing the duplicate elements, Nothing if no duplicates were found