Created
April 3, 2019 19:51
-
-
Save kmicinski/7a1eddc70f3d6af62b8acff7457e0d01 to your computer and use it in GitHub Desktop.
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
; Some church-encoding hints | |
#lang racket | |
(define (build-an-argument-list arg-list f) | |
(match arg-list | |
[(list x) `(,f ,x)] | |
[`(,hd . ,tl) `(,(build-an-argument-list tl f) ,hd)])) | |
(match '(2 3 5) | |
[`(,f . ,args) args]) | |
(define (cons a b) | |
(λ (when-cons) (λ (when-null) | |
(when-cons a b)))) | |
(define empty | |
(λ (when-cons) (λ (when-null) | |
(when-null)))) | |
(define l1 empty) | |
(define l2 (cons 1 empty)) | |
((l1 (λ (car cdr) (display car))) (λ () (display "nothing..."))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment