Module
Data.Array.Extra.All
- Package
- purescript-arrays-extra
- Repository
- flip111/purescript-arrays-extra
#findIndices Source
findIndices :: forall a. (a -> Boolean) -> Array a -> Array Int
Find the all the indices for which a predicate holds.
findIndices (contains $ Pattern "b") ["a", "bb", "b", "d"] = [1, 2]
findIndices (contains $ Pattern "x") ["a", "bb", "b", "d"] = []
#updateAllWith Source
updateAllWith :: forall a. (a -> Boolean) -> a -> Array a -> Array a
Find all elements matching a predicate and replace them with another element.
updateAllWith odd 4 [1,2,3] == Just [4,2,4]