There was an error while loading. Please reload this page.
1 parent 747a997 commit 9692125Copy full SHA for 9692125
chapter05-List-comprehensions/8.hs
@@ -0,0 +1,5 @@
1
+find :: Eq a => a -> [(a, b)] -> [b]
2
+find k t = [v | (k', v) <- t, k == k']
3
+
4
+positions :: Eq a => a -> [a] -> [Int]
5
+positions x xs = find x [(x, i) | (x, i) <- zip xs [0..]]
0 commit comments