Skip to content

Instantly share code, notes, and snippets.

@naldoco
Created July 6, 2017 19:39
Show Gist options
  • Save naldoco/4163d725694eef9aac6b91241550698a to your computer and use it in GitHub Desktop.
Save naldoco/4163d725694eef9aac6b91241550698a to your computer and use it in GitHub Desktop.
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.
* 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])
-}
@naldoco
Copy link
Author

naldoco commented Jul 6, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment