Water collected between towers: Difference between revisions
Content added Content deleted
m (→{{header|Haskell}}: Tidied) |
|||
Line 1,328: | Line 1,328: | ||
<lang haskell>import Data.List (replicate, transpose) |
<lang haskell>import Data.List (replicate, transpose) |
||
-------------- WATER COLLECTED BETWEEN TOWERS ------------ |
|||
towerPools :: [Int] -> [(Int, Int)] |
towerPools :: [Int] -> [(Int, Int)] |
||
Line 1,334: | Line 1,336: | ||
>>= zipWith ((<*>) (,) . (-)) |
>>= zipWith ((<*>) (,) . (-)) |
||
--------------------------- TEST ------------------------- |
|||
main :: IO () |
main :: IO () |
||
main = |
main = |
||
Line 1,346: | Line 1,350: | ||
[6, 7, 10, 7, 6] |
[6, 7, 10, 7, 6] |
||
] |
] |
||
------------------------- DIAGRAMS ----------------------- |
|||
display :: [(Int, Int)] -> String |
display :: [(Int, Int)] -> String |