Skip to content

Instantly share code, notes, and snippets.

@kaveet
Created December 24, 2016 20:45
Show Gist options
  • Save kaveet/5b87195010d5eff624534e0dfb1186c7 to your computer and use it in GitHub Desktop.
Save kaveet/5b87195010d5eff624534e0dfb1186c7 to your computer and use it in GitHub Desktop.
Haskell duplicate each entry in a list
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