Idiomatically determine all the lowercase and uppercase letters: Difference between revisions
Idiomatically determine all the lowercase and uppercase letters (view source)
Revision as of 10:40, 16 April 2022
, 2 years ago→{{header|Haskell}}
Line 561:
And if we want to generalise a little beyond a narrowly Anglo-Saxon notion of alphabets:
<lang Haskell>import Control.Monad (join)
import Data.Bool (bool)▼
import Data.Bifunctor (bimap, second)
▲import Data.Bool (bool)
import Data.Char (chr, isLower, isPrint, isUpper)
import Data.List (partition)
import Data.List.Split (chunksOf)
----------- ALL LOWERCASE AND UPPERCASE LETTERS ----F------
uppersAndLowers :: (String, String)
uppersAndLowers =
Line 575:
( partition isUpper $
[1 .. 0x10ffff]
>>=
)
--------------------------- TEST -------------------------
main :: IO ()
|