This file contains hidden or 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 |
This file contains hidden or 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
| (define (f x) | |
| ;; implicit recursive call to `f` not instrumented by the library | |
| (with-handlers ([number? f]) | |
| (raise (add1 x)))) | |
| (begin/termination (f 0)) |
This file contains hidden or 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
| (module lib racket | |
| (provide | |
| (contract-out | |
| ;; old model didn't have integer division | |
| [quotient (->i ([n (and/c integer? (>=/c 0))]) | |
| (res (n) (->i ([d (and/c integer? (>/c 0))]) | |
| (res (d) (and/c integer? | |
| (>=/c 0) | |
| (λ (r) (<= (* r d) n)))))))] | |
| [length ((listof any/c) . -> . (and/c integer? (>=/c 0)))] |
This file contains hidden or 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
| (define L | |
| (λ (x) | |
| (cond | |
| ;; `x` is higher order | |
| [(proc? x) | |
| (cond ;; Send message `L_x` to `x` and transfer controll to `L_f`, with `L_f`'s shape to be decided | |
| [L_1 ((L_f (x L_x)) x)] | |
| ;; Return closure referencing `x`, with `L_g`'s shape to be decided | |
| ;; Shu-Hung pointed out that this case was redundant | |
| ;; [L_2 (λ (y) ((L_g x) y))] |
This file contains hidden or 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 typed/racket/base | |
| (require racket/match | |
| racket/list | |
| racket/set | |
| bnf) | |
| (Color . ⩴ . 'green 'yellow 'black 'brown 'red 'pink 'blue) | |
| (Name . ≜ . Symbol) | |
| (Piece . ≜ . (Piece [digit : Integer] [color : Color]) #:ad-hoc) |
This file contains hidden or 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 racket/contract | |
| racket/set | |
| racket/match | |
| redex) | |
| (define-language L | |
| ;; Syntax | |
| ;; λ-calculus extended with: |
This file contains hidden or 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 racket/match | |
| racket/contract | |
| racket/list | |
| racket/function | |
| (only-in typed/racket/base assert)) | |
| ;; Assume primitive `induct-on` that can inspect contracts | |
| ;; and produce induction principles for *some* contracts | |
| ;; deemed to specify inductive data |
This file contains hidden or 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 racket/set | |
| racket/list | |
| racket/match | |
| racket/syntax | |
| redex) | |
| (define-language L | |
| ;; Syntax |
This file contains hidden or 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
| ;; Module `main` requires an identifier from module `helper-1.rkt` without `fake-contract` in there | |
| (module main racket | |
| (#%module-begin | |
| (module configure-runtime '#%kernel | |
| (#%module-begin (#%require racket/runtime-config) (#%app configure '#f))) | |
| (#%require soft-contract/fake-contract) | |
| (#%require helper-1.rkt) | |
| (define-values | |
| (lifted.0) | |
| (#%app |
This file contains hidden or 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
| ;; Module `main` requires an identifier from module `helper-1.rkt` with `fake-contract` in there | |
| (module main racket | |
| (#%module-begin | |
| (module configure-runtime '#%kernel | |
| (#%module-begin (#%require racket/runtime-config) (#%app configure '#f))) | |
| (#%require soft-contract/fake-contract) | |
| (#%require helper-1.rkt) | |
| (define-values | |
| (lifted.0) | |
| (begin |