Skip to content

Instantly share code, notes, and snippets.

@slimane
Last active January 2, 2016 02:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save slimane/8238800 to your computer and use it in GitHub Desktop.
Save slimane/8238800 to your computer and use it in GitHub Desktop.
ack :: (Integer, Integer) -> Integer
ack (0, n) = n + 1
ack (m, 0) = ack(m - 1, 1)
ack (m, n) = ack(m -1, ack(m, n-1))
ackGuard :: (Integer, Integer) -> Integer
ackGuard (m, n)
| m == 0 = n + 1
| n == 0 = ackGuard(m - 1, 1)
| otherwise = ackGuard(m -1, ackGuard(m, n-1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment