projects
/
advent-of-code-16.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f9f0bc2
)
Tidying
author
Neil Smith
<neil.git@njae.me.uk>
Fri, 16 Dec 2016 08:57:33 +0000
(08:57 +0000)
committer
Neil Smith
<neil.git@njae.me.uk>
Fri, 16 Dec 2016 08:57:33 +0000
(08:57 +0000)
advent16.hs
patch
|
blob
|
history
diff --git
a/advent16.hs
b/advent16.hs
index 80474b5ad8b6a392eb9fbd0ff0404251acaf243a..0c7bfbbf40c41588d11f7f35ff0a33005efcad22 100644
(file)
--- a/
advent16.hs
+++ b/
advent16.hs
@@
-32,10
+32,7
@@
checksum :: String -> String
checksum digits
| odd $ length digits = digits
| otherwise = checksum $ map (checksumPair) $ pairs digits
-
-
-checksumPair :: String -> Char
-checksumPair p = if (length $ nub p) == 1 then '1' else '0'
+ where checksumPair p = if (length $ nub p) == 1 then '1' else '0'
pairs :: [a] -> [[a]]