#lang lazy | |
; put racket instead of lazy in the line above to make it less lazy | |
(struct zero () #:transparent) | |
(struct succ (pred) #:transparent) | |
(define one (succ (zero))) | |
(define two (succ one)) | |
(define (inf) (succ (inf))) | |
(define (<= a b) | |
(cond | |
[(zero? a) #t] | |
[(zero? b) #f] | |
[else (<= (succ-pred a) (succ-pred b))])) | |
#| | |
can try these in the REPL... | |
(<= one two) | |
(<= two one) | |
(<= two (inf)) | |
(<= (inf) two) | |
(<= (inf) (inf)) | |
|# | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment