Idiomatically determine all the lowercase and uppercase letters: Difference between revisions

→‎{{header|Haskell}}: Used Data.List.Split chunksOf (rather than defining one by hand) for a little more focus.
m (→‎{{header|Haskell}}: Reduced a little in terms of Data.Bifunctor)
(→‎{{header|Haskell}}: Used Data.List.Split chunksOf (rather than defining one by hand) for a little more focus.)
Line 328:
import Data.Bifunctor (second)
import Data.List (partition)
import Data.List.Split (chunksOf)
 
uppersAndLowers :: (String, String)
Line 334 ⟶ 335:
(fst . partition isLower)
(partition isUpper $ filter isPrint (chr <$> [1 .. 0x10ffff]))
 
chunksOf :: Int -> [a] -> [[a]]
chunksOf i xs = take i <$> ($ (:)) (splits xs) []
where
splits [] _ n = []
splits l c n = l `c` splits (drop i l) c n
 
main :: IO ()
9,655

edits