Created
June 9, 2019 09:59
-
-
Save Glorp/979b7c23b7e650f45fb7372671bc5f8c to your computer and use it in GitHub Desktop.
This file contains 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
#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