Created
April 20, 2013 05:29
-
-
Save BinRoot/5424869 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
| import Data.List | |
| main = do | |
| print "hi" | |
| list1 = ["aa", "bb", "cc"] | |
| list2 = ["bb", "cc"] | |
| getMatches list1 list2 = getMatches' (check list1 list2) list2 | |
| getMatches' indices list2 = map (f list2) (filter (>=0) indices) | |
| f list2 x = list2 !! x | |
| check list1 list2 = map getTheIndex (check' list1 list2) | |
| getTheIndex (Just a) = a | |
| getTheIndex Nothing = -1 | |
| check' [] list2 = [] | |
| check' list1 list2 = (elemIndex (head list1) list2) : (check' (tail list1) list\ | |
| 2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment