Added plus, fixed some comments

This commit is contained in:
William J. Bowman 2015-01-19 20:20:25 -05:00
parent c359631268
commit de202fa6a0

View File

@ -57,15 +57,16 @@
[s (lambda (x : nat) x)])) [s (lambda (x : nat) x)]))
(check-equal? (sub1 (s z)) z) (check-equal? (sub1 (s z)) z)
#|
;; TODO: Plus require recursion and I don't have recursion! ;; TODO: Plus require recursion and I don't have recursion!
(define (plus (n1 : nat) (n2 : nat)) (define plus
(case n1 (fix (plus : (forall* (n1 : nat) (n2 : nat) nat))
[z n2] (lambda (n1 : nat)
[s (λ (x : nat) (plus x (s n2)))])) (lambda (n2 : nat)
(case n1
[z n2]
[s (λ (x : nat) (plus x (s n2)))])))))
(check-equal? (plus (s (s z)) (s (s z))) (s (s (s z)))) (check-equal? (plus (s (s z)) (s (s z))) (s (s (s (s z)))))
|#
;; ------------------- ;; -------------------
;; It's annoying to have to write things explicitly curried ;; It's annoying to have to write things explicitly curried
@ -109,7 +110,7 @@
;; ------------------- ;; -------------------
;; Ugh, why did the language implementer make the syntax for case so stupid? ;; Ugh, why did the language implementer make the syntax for case so stupid?
;; I wish I could fix that ... Oh I can. ;; I wish I could fix that ... Oh I can.
(begin-for-syntax (begin-for-syntax
(define (rewrite-clause clause) (define (rewrite-clause clause)
@ -239,7 +240,7 @@
;; ------------------- ;; -------------------
;; Okay but what about *real* proofs, like formalizing STLC, complete ;; Okay but what about *real* proofs, like formalizing STLC, complete
;; with fancy syntax for type checking? ;; with fancy syntax?
(data type : Type (data type : Type
(Unit : type) (Unit : type)