Skip to content

Commit

Permalink
Remove use of head.
Browse files Browse the repository at this point in the history
  • Loading branch information
chungyc committed Jun 1, 2024
1 parent 536779b commit a05b6b3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/Problems/P98Spec.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{-# OPTIONS_GHC -Wno-x-partial -Wno-unrecognised-warning-flags #-}

{-|
Copyright: Copyright (C) 2023 Yoo Chung
License: GPL-3.0-or-later
Expand Down Expand Up @@ -55,7 +53,9 @@ spec = parallel $ do

getRows :: [[Bool]] -> [[Int]]
getRows = map lengths
where lengths bs = map length $ filter head $ group bs
where lengths bs = map length $ filter occupied $ group bs
occupied (v:_) = v
occupied [] = False

getColumns :: [[Bool]] -> [[Int]]
getColumns = getRows . transpose
Expand Down

0 comments on commit a05b6b3

Please sign in to comment.