Last active
October 17, 2019 11:19
-
-
Save edgerunner/5952e80810e6928f2a53f71a55648feb to your computer and use it in GitHub Desktop.
Spelling book generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
speller :: [[Char]] -> [Char] | |
speller list = | |
spell (filter ((/=) "") list) | |
spell :: [[Char]] -> [Char] | |
spell [] = [] | |
spell [single] = | |
isFor single | |
spell [first, second] = | |
isFor first ++ " and " ++ isFor second | |
spell (first:rest) = | |
isFor first ++ ", " ++ spell rest | |
isFor :: [Char] -> [Char] | |
isFor [single] = | |
single : " is just " ++ [single] | |
isFor (first:rest) = | |
first : " is for " ++ (first:rest) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment