Last active
August 29, 2015 14:01
-
-
Save loosechainsaw/70d236fad9b14c9c26e4 to your computer and use it in GitHub Desktop.
appendSwapped.hs
This file contains hidden or 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 Main where | |
appendSwapped :: [(a,a)] -> [(a,a)] | |
appendSwapped [] = [] | |
appendSwapped xs = xs ++ (flipped xs) | |
where flipped li = foldr (\c d -> swaptuple c : d ) [] li | |
swaptuple (a,b) = (b,a) | |
main :: IO () | |
main = print $ appendSwapped [(1,2), (3,4)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment