Skip to content

Instantly share code, notes, and snippets.

@philnguyen
Created November 16, 2018 18:40
Show Gist options
  • Save philnguyen/795697cdb0977fbe865073b409bb7a14 to your computer and use it in GitHub Desktop.
Save philnguyen/795697cdb0977fbe865073b409bb7a14 to your computer and use it in GitHub Desktop.
open recursive ack
#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