Created
December 24, 2016 20:45
-
-
Save kaveet/5b87195010d5eff624534e0dfb1186c7 to your computer and use it in GitHub Desktop.
Haskell duplicate each entry in a 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
module Duplicate where | |
duplicate :: [a] -> [a] | |
duplicate [] = [] | |
duplicate (x:xs) = [x, x] ++ duplicate xs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment