Skip to content

Instantly share code, notes, and snippets.

@jamiltron
Created January 27, 2012 04:59
Show Gist options
  • Save jamiltron/1687081 to your computer and use it in GitHub Desktop.
Save jamiltron/1687081 to your computer and use it in GitHub Desktop.
Exercise 5.2.1 from TAPL in Racket
#lang racket
;; tru = \t. \f. t
(define tru
(lambda [t]
(lambda [f] t)))
;; fls = \t. \f. f
(define fls
(lambda [t]
(lambda [f] f)))
;; l-and = \b. \c. b c fls
(define l-and
(lambda [b]
(lambda [c]
((b c) fls))))
;; l-or = \b. \c. b tru c
(define l-or
(lambda [b]
(lambda [c]
((b tru) c))))
;; l-not = \b. b fls tru
(define l-not
(lambda [b]
((b fls) tru)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment