Last active
February 23, 2019 00:50
-
-
Save ConnorBaker/00d388cc2d844d3dd9a56e4c57ee6fc7 to your computer and use it in GitHub Desktop.
Programming in Haskell, 2nd ed.: Chapter 5: Problem 8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| find :: Eq a => a -> [(a,b)] -> [b] | |
| find k t = [v | (k',v) <- t, k == k'] | |
| positions :: Eq a => a -> [a] -> [Int] | |
| positions x xs = [i | (x',i) <- zip xs [0..], x == x'] | |
| positions' :: Eq a => a -> [a] -> [Int] | |
| positions' x xs = find x (zip xs [0..]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment