whoopsies! this code crashed on certain datasets before

This commit is contained in:
Jill 2022-12-05 09:52:42 +03:00
parent 33b2da66c3
commit a1776f40c9
2 changed files with 2 additions and 2 deletions

2
5-a.hs
View File

@ -5,7 +5,7 @@ import GHC.Utils.Misc (chunkList)
import Data.Char (isSpace, isNumber)
rotate2DList :: [[a]] -> [[a]]
rotate2DList l = map (\i -> map (!! i) l) [0 .. length l]
rotate2DList l = map (\i -> map (!! i) l) [0 .. length (head l) - 1]
parseState :: String -> [[Char]]
parseState = map (dropWhile isSpace) . rotate2DList . map (map (!! 1) . chunkList 4) . init . lines

2
5-b.hs
View File

@ -5,7 +5,7 @@ import GHC.Utils.Misc (chunkList)
import Data.Char (isSpace, isNumber)
rotate2DList :: [[a]] -> [[a]]
rotate2DList l = map (\i -> map (!! i) l) [0 .. length l]
rotate2DList l = map (\i -> map (!! i) l) [0 .. length (head l) - 1]
parseState :: String -> [[Char]]
parseState = map (dropWhile isSpace) . rotate2DList . map (map (!! 1) . chunkList 4) . init . lines