Jump to content

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

m
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]
>>= (((bool [] . pure) <*> isPrint) . chr)
)
 
--------------------------- TEST -------------------------
main :: IO ()
9,655

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.