Skip to content

Instantly share code, notes, and snippets.

@thomwiggers
Created October 14, 2012 14:24
Show Gist options
  • Save thomwiggers/3888750 to your computer and use it in GitHub Desktop.
Save thomwiggers/3888750 to your computer and use it in GitHub Desktop.
addList :: [[a]] -> [[a]] -> [[a]]
addList left right
| length left == length right = addList' left right []
| otherwise = error "list lengths not equal"
where
addList' [] [] acc = acc
addList' [] _ _ = error "not equal len l < r"
addList' _ [] _ = error "not equal len l > r"
addList' (l:eft) (r:ight) acc = addList' eft ight (acc ++ [l++r])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment