# Land of some other order

(2019-06-09. Index.)

#lang racket
or
#lang lazy

And make some natural numbers and also one maybe unnatural.

```(struct zero () #:transparent)
(struct succ (pred) #:transparent)

(define one (succ (zero)))
(define two (succ one))
(define (inf) (succ (inf)))```

And a less-than-or-equal-to function.

```(define (<= a b)
(cond
[(zero? a) #t]
[(zero? b) #f]
[else (<= (succ-pred a) (succ-pred b))]))```

(<= is a function with parameters a and b: If a is zero then true else if b is zero then false else try with one-less-than-a and one-less-than-b instead.)

Okay. We can try to apply the function to some arguments. The following are are fine and evaluate to #t and #f.

`(<= one two)`
`(<= two one)`

If we started with #lang racket the next two will run forever and we won’t get values back. If we started with #lang lazy they’re fine and evaluate to #t and #f.

`(<= two (inf))`
`(<= (inf) two)`

The last one will run forever in both #lang racket and #lang lazy.

`(<= (inf) (inf))`

(Forever means until we are out of memory or something.)

Anyway. We can like choose.

• If we want as many expressions as possible to give back values, we might prefer #lang lazy.
• If we want as many applications of <= to give back values, we might prefer #lang racket.

(In #lang racket the forever happens when evaluating the (inf)-arguments before the <=-function is applied. In #lang lazy we might have to decide: Is it the (inf) or the <= that causes forever? Is it reasonably to expect there to be a zero? base case?)

(Mlep. Code here. We could have used like some Standard ML code and some Haskell code or something instead. Just, handy to use “the same” code for both versions and only switch between the two #langs. And then also we are not writing Racket code exactly the way we normally would, but like, sticking to reasonably basic stuff andalso stuff that works in both #lang racket and #lang lazy.)