Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Greater Than" Operator in Racket with 3 Arguments

Looking at > in Racket, the following makes sense:

> (> 5 0)
#t

Why does the following evaluate to false?

> (> 5 0 0)
#f
like image 989
Kevin Meredith Avatar asked Mar 30 '15 15:03

Kevin Meredith


2 Answers

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.

like image 154
Óscar López Avatar answered Oct 06 '22 00:10

Óscar López


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

like image 39
soegaard Avatar answered Oct 06 '22 00:10

soegaard