Created
November 4, 2014 22:45
-
-
Save lwiechec/50904e98eacab1e6820c to your computer and use it in GitHub Desktop.
double every second element of the list
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
-- | |
-- I didn't check the exercise, can we use take, double and drop? | |
-- | |
double :: Num a => [a] -> [a] | |
double [] = [] | |
double (x:xs) = [2*x] ++ take 1 xs ++ double (drop 1 xs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment