56 lines
1.6 KiB
Markdown
56 lines
1.6 KiB
Markdown
# Comparison
|
|
|
|
## `eq`
|
|
```
|
|
(eq value &rest values)
|
|
```
|
|
`eq` returns t if all `values` are equal to `value`, or nil if any are
|
|
not.
|
|
|
|
For two values to be equal according to `eq`, they must have the same
|
|
type. In all cases **except strings**, `eq` compares the immediate value
|
|
as returned by [`addr-of`](stdlib_misc.md#addr-of). However, `eq` will
|
|
return t for strings with identical contents, **regardless of their
|
|
addresses**. To check if two strings reference the same location in
|
|
memory, compare their `addr-of`.
|
|
|
|
## `=`
|
|
```
|
|
(= value &rest values)
|
|
```
|
|
`=` compares its arguments numerically. If they are all equal, it
|
|
returns `value`, otherwise it returns nil. If any argument is not an int
|
|
or float, `=` returns nil.
|
|
|
|
## `<`
|
|
```
|
|
(< value &rest values)
|
|
```
|
|
`<` compares its arguments numerically. If the sequence is monotonically
|
|
increasing, it returns the last argument, otherwise it returns nil. If
|
|
any argument is not an int or float, `<` returns nil.
|
|
|
|
## `>`
|
|
```
|
|
(> value &rest values)
|
|
```
|
|
`>` compares its arguments numerically. If the sequence is monotonically
|
|
decreasing, it returns the last argument, otherwise it returns nil. If
|
|
any argument is not an int or float, `>` returns nil.
|
|
|
|
## `<=`
|
|
```
|
|
(<= value &rest values)
|
|
```
|
|
`<=` compares its arguments numerically. If the sequence is
|
|
monotonically nondecreasing, it returns the last argument, otherwise it
|
|
returns nil. If any argument is not an int or float, `<=` returns nil.
|
|
|
|
## `>=`
|
|
```
|
|
(>= value &rest values)
|
|
```
|
|
`>=` compares its arguments numerically. If the sequence is
|
|
monotonically nonincreasing, it returns the last argument, otherwise it
|
|
returns nil. If any argument is not an int or float, `>=` returns nil.
|