Skip to content

Instantly share code, notes, and snippets.

@chrisdone
Forked from Gabriella439/ackermann.dhall
Last active April 7, 2020 09:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisdone/23654c576759671d92360b6130b51b0b to your computer and use it in GitHub Desktop.
Save chrisdone/23654c576759671d92360b6130b51b0b to your computer and use it in GitHub Desktop.
Ackermann function in Dhall
-- Credit to: https://news.ycombinator.com/item?id=15186988
let iterate
: (Natural Natural) Natural Natural
= \f n ->
fold (n + 1) f 1
let increment : Natural Natural = \n -> n + 1
let ackermann
: Natural Natural Natural
= \m -> fold m iterate increment
in ackermann
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment