Skip to content

Instantly share code, notes, and snippets.

@aardvarrk
Created November 25, 2012 21:53
Show Gist options
  • Select an option

  • Save aardvarrk/4145556 to your computer and use it in GitHub Desktop.

Select an option

Save aardvarrk/4145556 to your computer and use it in GitHub Desktop.
map' :: (Int -> a -> b) -> [a] -> [b]
map' = map'' 0
where map'' :: Int -> (Int -> a -> b) -> [a] -> [b]
map'' _ _ [] = []
map'' i f (x:xs) = (f i x) : map'' (succ i) f xs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment