-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add more documentation for stdlib functions
includes a cheap workaround for the stdlib TOC 😁
- Loading branch information
Showing
32 changed files
with
876 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# eq? | ||
|
||
`eq?` compares two arguments for equalities. Equality is defined based on the | ||
currently active [coalescer](../coalescing.md), so for example with strict | ||
coalescing, `(eq 1 "1")` is false, but with humane coalescing is true. | ||
|
||
See also [`like?`](comparisons-like.md), which always uses humane coalescing, | ||
and [`identical?`](comparisons-identical.md), which always uses strict | ||
coalescing. | ||
|
||
## Examples | ||
|
||
* `(eq? "" "")` -> `true` | ||
* `(eq? 1 2)` -> `false` | ||
* `(eq? (+ 1 1) 2)` -> `true` | ||
|
||
## Forms | ||
|
||
### `(eq? left right)` | ||
|
||
* `left` is an arbitrary expression, except for identifiers. | ||
* `right` is likewise an arbitrary expression, except for identifiers. | ||
|
||
Both expressions are evaluated and then compared using the current coalescer. | ||
If evaluation of either of the expressions yields and error, that error is | ||
returned. | ||
|
||
Equality is not defined for all type combinations and so `eq?` can, depending | ||
on the coalescer, return errors for invalid comparisons. With strict coalescing, | ||
`(eq? true 2)` returns an error because numbers cannot be converted to booleans. | ||
With humane coalescing, true would be returned instead and no error is generated. | ||
|
||
## Context | ||
|
||
`eq?` executes both expressions in their own contexts, so nothing is shared. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# gt? | ||
|
||
`gt?` returns whether the first argument is numerically larger than the second. | ||
|
||
## Examples | ||
|
||
* `(gt? 3 2)` -> `true` | ||
* `(gt? 2.0 3)` -> `false` | ||
|
||
## Forms | ||
|
||
### `(gt? left right)` | ||
|
||
* `left` is an arbitrary expression, except for identifiers. | ||
* `right` is likewise an arbitrary expression, except for identifiers. | ||
|
||
`gt?` evaluates both expressions and coalesces their results to be numbers. If | ||
either evaluation or conversion fail, an error is returned. If the two arguments | ||
are valid numbers, the result of `left > right` is returned. | ||
|
||
## Context | ||
|
||
`gt?` executes both expressions in their own contexts, so nothing is shared. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# gte? | ||
|
||
`gte?` returns whether the first argument is numerically larger than or equal to | ||
the second. | ||
|
||
## Examples | ||
|
||
* `(gte? 3 2)` -> `true` | ||
* `(gte? 2.0 3)` -> `false` | ||
|
||
## Forms | ||
|
||
### `(gte? left right)` | ||
|
||
* `left` is an arbitrary expression, except for identifiers. | ||
* `right` is likewise an arbitrary expression, except for identifiers. | ||
|
||
`gte?` evaluates both expressions and coalesces their results to be numbers. If | ||
either evaluation or conversion fail, an error is returned. If the two arguments | ||
are valid numbers, the result of `left >= right` is returned. | ||
|
||
## Context | ||
|
||
`gte?` executes both expressions in their own contexts, so nothing is shared. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# identical? | ||
|
||
`identical?` compares two arguments for equalities. Equality is defined using the | ||
[strict coalescer](../coalescing.md#strict-coalescer), so `(identical? 1 "1")` | ||
yields a type error because strings cannot be converted to numbers. | ||
|
||
See also [`eq?`](comparisons-eq.md), which uses the currently selected coalescer, | ||
and [`like?`](comparisons-like.md), which always uses humane coalescing. | ||
|
||
## Examples | ||
|
||
* `(identical? 1 "1")` -> `false` | ||
* `(identical? 1 1.0)` -> `true` | ||
|
||
## Forms | ||
|
||
### `(identical? left right)` | ||
|
||
* `left` is an arbitrary expression, except for identifiers. | ||
* `right` is likewise an arbitrary expression, except for identifiers. | ||
|
||
Both expressions are evaluated and then compared using the current coalescer. | ||
If evaluation of either of the expressions yields and error, that error is | ||
returned. | ||
|
||
Equality is not defined for all type combinations and so `identical?` can return | ||
errors for invalid comparisons. See the coalescing documentation for conversion | ||
rules. | ||
|
||
## Context | ||
|
||
`identical?` executes both expressions in their own contexts, so nothing is | ||
shared. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# like? | ||
|
||
`like?` compares two arguments for equalities. Equality is defined using the | ||
[humane coalescer](../coalescing.md#humane-coalescer), so `(like? 1 "1")` yields | ||
no type error, but true. | ||
|
||
See also [`eq?`](comparisons-eq.md), which uses the currently selected coalescer, | ||
and [`identical?`](comparisons-identical.md), which always uses strict | ||
coalescing. | ||
|
||
## Examples | ||
|
||
* `(like? 1 "1")` -> `true` | ||
* `(like? 1 "2")` -> `false` | ||
|
||
## Forms | ||
|
||
### `(like? left right)` | ||
|
||
* `left` is an arbitrary expression, except for identifiers. | ||
* `right` is likewise an arbitrary expression, except for identifiers. | ||
|
||
Both expressions are evaluated and then compared using the current coalescer. | ||
If evaluation of either of the expressions yields and error, that error is | ||
returned. | ||
|
||
Equality is not defined for all type combinations, even with the humane coalescer, | ||
and so `like?` can return errors for invalid comparisons. See the coalescing | ||
documentation for conversion rules. | ||
|
||
## Context | ||
|
||
`like?` executes both expressions in their own contexts, so nothing is shared. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# lt? | ||
|
||
`lt?` returns whether the first argument is numerically smaller than the second. | ||
|
||
## Examples | ||
|
||
* `(lt? 3 2)` -> `false` | ||
* `(lt? 2.0 3)` -> `true` | ||
|
||
## Forms | ||
|
||
### `(lt? left right)` | ||
|
||
* `left` is an arbitrary expression, except for identifiers. | ||
* `right` is likewise an arbitrary expression, except for identifiers. | ||
|
||
`lt?` evaluates both expressions and coalesces their results to be numbers. If | ||
either evaluation or conversion fail, an error is returned. If the two arguments | ||
are valid numbers, the result of `left < right` is returned. | ||
|
||
## Context | ||
|
||
`lt?` executes both expressions in their own contexts, so nothing is shared. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# lte? | ||
|
||
`lte?` returns whether the first argument is numerically smaller than or equal to | ||
the second. | ||
|
||
## Examples | ||
|
||
* `(lte? 3 2)` -> `true` | ||
* `(lte? 2.0 3)` -> `false` | ||
|
||
## Forms | ||
|
||
### `(lte? left right)` | ||
|
||
* `left` is an arbitrary expression, except for identifiers. | ||
* `right` is likewise an arbitrary expression, except for identifiers. | ||
|
||
`lte?` evaluates both expressions and coalesces their results to be numbers. If | ||
either evaluation or conversion fail, an error is returned. If the two arguments | ||
are valid numbers, the result of `left <= right` is returned. | ||
|
||
## Context | ||
|
||
`lte?` executes both expressions in their own contexts, so nothing is shared. |
Oops, something went wrong.