Created
July 6, 2017 19:39
-
-
Save naldoco/4163d725694eef9aac6b91241550698a to your computer and use it in GitHub Desktop.
2-6. MORE MATCHES AND GUARDS
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. | |
* https://en.wikipedia.org/wiki/Ackermann_function | |
Pseudocode: | |
A (m,n) = | |
n+1 , m = 0 | |
A (m−1, 1 ) , m > 0, n = 0 | |
A (m − 1, A (m , n−1)) , m > 0, n > 0 | |
2) Define the unzip function, which takes a list of tuples | |
and returns two lists, one with all the first components. | |
unzip [] = ([],[]) | |
unzip [(1,2)] = ([1],[2]) | |
unzip [(1,2),(3,4)] = ([1,3],[2,4]) | |
-} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Código y ejercicios 'Beginning Haskell'
Código y ejercicios del libro Beginning Haskell de Alejandro Serrano Mena
El grupo de estudio de Haskell-MAD de este libro muestra aquí sus avances.
https://haskellnautas.slack.com/
https://haskellnautas.herokuapp.com/