From 0cfa172289d49a593e0d92bad30143068d130b3d Mon Sep 17 00:00:00 2001 From: Quinten Kock Date: Mon, 13 Dec 2021 07:12:42 +0100 Subject: [PATCH] do not use list form --- 2021/day13.hs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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]