diff --git a/2021/day13.hs b/2021/day13.hs index 125e579..40ab4f7 100644 --- a/2021/day13.hs +++ b/2021/day13.hs @@ -29,11 +29,10 @@ main = do print $ S.size dots1 putStrLn "part 2: " - let dots2 = map (\d -> foldl (flip fold) d folds) dots - let dots2' = S.fromList dots2 - let max_x = maximum $ map fst dots2 - let max_y = maximum $ map snd dots2 + let dots2 = S.fromList $ map (\d -> foldl (flip fold) d folds) dots + let max_x = maximum $ S.map fst dots2 + let max_y = maximum $ S.map snd dots2 mapM_ (\y -> do - mapM_ (\x -> putChar (if (x,y) `S.member` dots2' then '#' else '.')) [0..max_x] + mapM_ (\x -> putChar (if (x,y) `S.member` dots2 then '#' else '.')) [0..max_x] putStrLn "" ) [0..max_y]