42 lines
1.1 KiB
Markdown
42 lines
1.1 KiB
Markdown
|
# Arithmetic
|
||
|
|
||
|
## `+`
|
||
|
```
|
||
|
(+ &rest numbers)
|
||
|
```
|
||
|
`+` returns the sum of its arguments, skipping any inputs that are not
|
||
|
ints or floats. If no arguments are given, it returns 0.
|
||
|
|
||
|
## `-`
|
||
|
```
|
||
|
(- number)
|
||
|
(- number &rest more-numbers)
|
||
|
```
|
||
|
If called with one argument, `-` returns the negation of that argument.
|
||
|
If called with more than one argument, `-` subtracts `more-numbers` from
|
||
|
`number`, skipping any inputs that are not ints or floats.
|
||
|
If `number` is not an int or float, `-` returns nil.
|
||
|
|
||
|
## `*`
|
||
|
```
|
||
|
(* &rest numbers)
|
||
|
```
|
||
|
`*` returns the product of its arguments, skipping any inputs that are
|
||
|
not ints or floats. If no arguments are given, it returns 1.
|
||
|
|
||
|
## `/`
|
||
|
```
|
||
|
(/ number &rest more-numbers)
|
||
|
```
|
||
|
`/` divides `number` by `more-numbers`, skipping any inputs that are not
|
||
|
ints or floats. It always returns a float.
|
||
|
If `number` is not an int or float, `/` returns nil.
|
||
|
|
||
|
## `int/`
|
||
|
```
|
||
|
(int/ number &rest more-numbers)
|
||
|
```
|
||
|
`int/` performs integer division, dividing `number` by `more-numbers`,
|
||
|
skipping any inputs that are not ints or floats, and returning an int.
|
||
|
If `number` is not an int or float, `int/`returns nil.
|