[haskell] toy program
Viewer
- import Data.List (delete)
- keyWord :: String
- keyWord = "VIBGYOR"
- keyWordLength :: Int
- keyWordLength = length keyWord - 1
- number :: Integer
- number = 11
- colorChoice :: Int -> Char
- colorChoice number = if number <= keyWordLength
- then keyWord !! number
- else keyWord !! (number `mod` keyWordLength)
- uncommon :: Eq a => [a] -> [a] -> [a]
- uncommon xs ys = foldr delete xs ys ++ foldr delete ys xs
- getInputs :: IO()
- getInputs = do
- putStrLn "Enter your name: "
- input1 <- getLine
- putStrLn "Enter another name: "
- input2 <- getLine
- let firstName = input1
- let secondName = input2
- let output = colorChoice (length ( uncommon firstName secondName))
- print output
Editor
You can edit this paste and save as new: