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
{-https://github.com/haskell-esp/ejercicios-beginning-haskell | |
##### 2-6. MORE MATCHES AND GUARDS | |
Up to this point we have introduced matching on lists and | |
tuples, and guards. The following tasks will help you | |
ensure that you have understood those concepts. | |
1) Define the famous Ackermann function. Try using guard. |
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
{-https://github.com/haskell-esp/ejercicios-beginning-haskell | |
##### 2-5. THE PERFECT MATCH FOR YOUR TIME MACHINES | |
1) For statistical purposes, write a function that | |
returns the number of clients of each gender. | |
* You may need to define an auxiliary data type to hold the results of this function. | |
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
-- check "hola" "---a" 'b' = (False, "---a") | |
check :: String -> String -> Char -> (Bool,String) | |
check word display c = | |
(c `elem` word, [if x == c | |
then c | |
else y | (x, y) <- zip word display]) | |
mkguess :: String -> String -> Int -> IO () | |
mkguess word display n = | |
do putStrLn (display ++ " " ++ take n (repeat '*')) |