Last active
April 26, 2020 00:00
Ackermann function in Dhall
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
-- Credit to: https://news.ycombinator.com/item?id=15186988 | |
let iterate | |
: (Natural → Natural) → Natural → Natural | |
= λ(f : Natural → Natural) | |
→ λ(n : Natural) | |
→ Natural/fold (n + 1) Natural f 1 | |
let increment : Natural → Natural = λ(n : Natural) → n + 1 | |
let ackermann | |
: Natural → Natural → Natural | |
= λ(m : Natural) → Natural/fold m (Natural → Natural) iterate increment | |
in ackermann |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment