Created
November 16, 2018 18:40
-
-
Save philnguyen/795697cdb0977fbe865073b409bb7a14 to your computer and use it in GitHub Desktop.
open recursive ack
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
#lang racket/base | |
(require "../main.rkt") | |
(define (open-ack m n rec) | |
(cond [(zero? m) (+ 1 n)] | |
[(zero? n) (rec (- m 1) 1)] | |
[else (rec (- m 1) (rec m (- n 1)))])) | |
(define close | |
(terminating-function/c | |
(λ (f) | |
(λ (m n) | |
(f m n (close f)))))) | |
(define ack (terminating-function/c (close open-ack))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment