Skip to content

Instantly share code, notes, and snippets.

@Glorp Glorp/order.rkt
Created Jun 9, 2019

Embed
What would you like to do?
#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
You can’t perform that action at this time.