DEV Community

Discussion on: Daily Challenge #172 - Find All in an Array

Collapse
 
avalander profile image
Avalander • Edited

Haskell

Written on the phone, it might not work, I'll check it when I get home.

find_all :: [Int] -> Int -> [Int]
find_all xs n =
  [ snd x | x <- indexed if (fst x) == n ]
  where
    indexed = zip xs [0..(length xs)]