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:
fe0d18e
)
Tweaks
author
Neil Smith
<neil.git@njae.me.uk>
Sat, 3 Dec 2016 20:47:17 +0000
(20:47 +0000)
committer
Neil Smith
<neil.git@njae.me.uk>
Sat, 3 Dec 2016 20:47:17 +0000
(20:47 +0000)
advent03.hs
patch
|
blob
|
history
diff --git
a/advent03.hs
b/advent03.hs
index 3a6357d9d08fa30b06f3311023fbe4e194685e67..a9a23532ca4d7883563c91613688a04d0f4e8505 100644
(file)
--- a/
advent03.hs
+++ b/
advent03.hs
@@
-23,7
+23,9
@@
part2 triangles = do
parseLine :: String -> Triple
parseLine = map (read) . filter (not . null) . splitOn " "
+validTriangle :: Triple -> Bool
validTriangle triple = sortedTriple!!0 + sortedTriple!!1 > sortedTriple!!2
where sortedTriple = sort triple
-byColumns triangles = chunksOf 3 $ concat $ transpose triangles
+byColumns :: [[Integer]] -> [Triple]
+byColumns = chunksOf 3 . concat . transpose