Created
July 5, 2017 14:51
-
-
Save okkero/d31f621a10d31166c5398f2b64de5d7a to your computer and use it in GitHub Desktop.
This file contains 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 | |
onOdds :: ([a] -> [a]) -> [a] -> [a] | |
onOdds f xs = | |
let | |
(odds, evens) = partition (odd . fst) $ zip [0..] xs | |
in | |
concat $ | |
zipWith | |
(\a b -> [a, b]) | |
(snd <$> evens) | |
(f $ snd <$> odds) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment