Skip to content

Instantly share code, notes, and snippets.

@kmicinski
Created April 3, 2019 19:51
Show Gist options
  • Save kmicinski/7a1eddc70f3d6af62b8acff7457e0d01 to your computer and use it in GitHub Desktop.
Save kmicinski/7a1eddc70f3d6af62b8acff7457e0d01 to your computer and use it in GitHub Desktop.
; 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