Created
September 8, 2016 04:11
-
-
Save jjlumagbas/2245ea4266a5552823017458c93c2782 to your computer and use it in GitHub Desktop.
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
-- from Don Sanella | |
-- http://www.inf.ed.ac.uk/teaching/courses/inf1/fp/ | |
searchRec :: Eq a => [a] -> a -> [Int] | |
searchRec xs y = srch xs y 0 | |
where | |
srch :: Eq a => [a] -> a -> Int -> [Int] | |
srch [] y i = [] | |
srch (x:xs) y i | |
| x == y = i : srch xs y (i+1) | |
| otherwise = srch xs y (i+1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment