Skip to content

Instantly share code, notes, and snippets.

View naldoco's full-sized avatar

Reynaldo Cordero naldoco

View GitHub Profile
-- 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 '*'))
@naldoco
naldoco / 2-5-Q-ThePerfectMatch.hs
Last active July 10, 2017 13:29
2-5. THE PERFECT MATCH FOR YOUR TIME MACHINES
{-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.
@naldoco
naldoco / 2-6-Q-MoreMatchesAndGuards.hs
Created July 6, 2017 19:39
2-6. MORE MATCHES AND GUARDS
{-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.