"Greater Than" Operator in Racket with 3 Arguments
Asked Answered
F

2

5

Looking at > in Racket, the following makes sense:

> (> 5 0)
#t

Why does the following evaluate to false?

> (> 5 0 0)
#f
Freighter answered 30/3, 2015 at 15:17 Comment(1)
Because 0 is not greater than 0 but equal.Headland
H
8

Because (> 5 0 0) is the same as:

(and (> 5 0) (> 0 0))

...Which is #f. For comparison, evaluate (>= 5 0 0) and you'll see that it returns #t.

Hellgrammite answered 30/3, 2015 at 15:24 Comment(0)
P
6

Pronounce > as strictly decreasing and >= as non-increasing. Then it becomes easy to see that (> 5 0 0) is false.

Phyletic answered 30/3, 2015 at 16:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.