Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,9 @@
quibble ws = "{" ++ quibbles ws ++ "}"
where quibbles [] = ""
quibbles [a] = a
quibbles [a,b] = a ++ " and " ++ b
quibbles (a:bs) = a ++ ", " ++ quibbles bs
main = mapM_ (putStrLn . quibble) $
[[], ["ABC"], ["ABC", "DEF"], ["ABC", "DEF", "G", "H"]] ++
(map words ["One two three four", "Me myself I", "Jack Jill", "Loner" ])

View file

@ -0,0 +1,15 @@
import Data.List (intercalate)
quibble :: [String] -> String
quibble ws
| length ws > 1 =
intercalate
" and "
([intercalate ", " . reverse . tail, head] <*> [reverse ws])
| otherwise = concat ws
main :: IO ()
main =
mapM_ (putStrLn . (`intercalate` ["{", "}"]) . quibble) $
[[], ["ABC"], ["ABC", "DEF"], ["ABC", "DEF", "G", "H"]] ++
(words <$> ["One two three four", "Me myself I", "Jack Jill", "Loner"])