Last active
April 28, 2018 02:11
-
-
Save philnguyen/4d9bd0dd4a9237a20cd9397e4e221c4a to your computer and use it in GitHub Desktop.
General shape of (1-arg) higher-order counterexample in Racket
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
(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))] | |
;; Return constant | |
[else L_a])] | |
;; `x` is first-order | |
[else (L' x)]))) | |
;; where ... | |
(define L' (λ (x) #|dispatch on first-order `x`|#)) | |
(define-values (L_f L_g L_a L_x) #|constants, first or higher-order|#) | |
(define-values (L_1 L_2) #|constants, only truth values matter|#) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment