aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2021-07-05 22:20:19 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2021-07-05 22:20:19 -0400
commitc96289046dbd42678c10d03ceb5734737392bf4c (patch)
treefc897441ab6de8f5453aceb0424ff3969c696d4f /doc
parent3734638f2f04b5e298dca250f589ae1e4913f88f (diff)
Inter-documentation links and minor editing
Diffstat (limited to 'doc')
-rw-r--r--doc/arithmetic.md6
-rw-r--r--doc/based.md6
-rw-r--r--doc/couple.md4
-rw-r--r--doc/depth.md18
-rw-r--r--doc/fold.md8
5 files changed, 21 insertions, 21 deletions
diff --git a/doc/arithmetic.md b/doc/arithmetic.md
index feb97083..fa1067bf 100644
--- a/doc/arithmetic.md
+++ b/doc/arithmetic.md
@@ -49,7 +49,7 @@ Each of these functions also has a meaning with only one argument, although in m
√ 0‿1‿2‿4
-Take note of the difference between the function `-`, and the "high minus" character `¯`, which is a part of numeric notation. Also shown is the number `∞`, which BQN supports along with `¯∞` (but depending on implementation BQN may or may not keep track of `¯0`. Integer optimization loses the distinction so it's best not to rely on it).
+Take note of the difference between the function `-`, and the "high minus" character `¯`, which is a part of [numeric notation](syntax.md#constants). Also shown is the number `∞`, which BQN supports along with `¯∞` (but depending on implementation BQN may or may not keep track of `¯0`. Integer optimization loses the distinction so it's best not to rely on it).
The logarithm is written with Undo: `⋆⁼`. As with Power, the default base is *e*, giving a natural logarithm.
@@ -114,7 +114,7 @@ Symbol | Monad | Dyad
`⌈` | Ceiling | Maximum
`\|` | Absolute Value | Modulus
-Now the monadic function symbols resemble those used in mathematics. In the case of Floor and Ceiling, this is because Ken Iverson invented them! As with other functions, he adapted them to work like other functions in order to create APL\360, in this case by removing the paired closing version of each one.
+Now the monadic function symbols resemble those used in mathematics. In the case of Floor and Ceiling, this is because Ken Iverson invented them! As with other functions, he adapted them to use more uniform syntax in order to create APL\360, in this case by removing the paired closing version of each one.
⌊ π
@@ -159,7 +159,7 @@ The *ordered* comparisons `≤<>≥` are defined on numbers and characters (and
¯∞‿π‿∞ ≥ @‿'0'‿'?'
-Equals and Not Equals are the two *equality* comparisons. Equals tests for [atomic equality](match.md#atomic-equality) between each pair of atoms, as described in the Match documentation. Essentially, it returns `1` only if the two values are indistinguishable to BQN and `0` otherwise. Values of different types can never be equal, and characters are equal when they have the same code point.
+Equals and Not Equals are the two *equality* comparisons. Equals tests for atomic equality between each pair of atoms, as [described](match.md#atomic-equality) in the Match documentation. Essentially, it returns `1` only if the two values are indistinguishable to BQN and `0` otherwise. Values of different types can never be equal, and characters are equal when they have the same code point.
+‿-‿×‿÷ = ⊑⟨-⟩
diff --git a/doc/based.md b/doc/based.md
index 38139032..9b363107 100644
--- a/doc/based.md
+++ b/doc/based.md
@@ -10,9 +10,9 @@ If you're an array programmer then I have bad news for you. My thesis here is th
## Starting from atoms
-APL tends to define its data by starting with the array and then looking downwards in depth at what it contains. The based array model, as the name suggests, starts at the foundations, which in BQN are called "atoms". There are five types of atom, which together with the array type give the six types a value can have in BQN. Based means being yourself, and an atom's *not* an array.
+APL tends to define its data by starting with the array and then looking downwards in depth at what it contains. The based array model, as the name suggests, starts at the foundations, which in BQN are called "atoms". There are six [types](types.md) of atom, which together with the array type give the seven types a value can have in BQN. Based means being yourself, and an atom's *not* an array.
-An atom has [depth](depth.md) 0, and doesn't inherently have a shape. However, primitives that expect an array promote atoms by [enclosing](enclose.md) them to get a rank-0, or *unit*, array that contains the atom (any value can be enclosed in this way, giving a unit array with higher depth, but it only happens automatically for atoms). Rank and shape both do this, so an atom can be considered to have the same dimensions as a unit array: rank 0 and shape `⟨⟩`. An atom is also considered a kind of unit, but it's not a unit array.
+An atom has [depth](depth.md) 0, and doesn't inherently have a shape. However, primitives that expect an array promote atoms by [enclosing](enclose.md) them to get a rank-0, or *unit*, array that contains the atom (any value can be enclosed in this way, giving a unit array with higher depth, but it only happens automatically for atoms). [Rank and shape](shape.md) both do this, so an atom can be considered to have the same dimensions as a unit array: rank 0 and shape `⟨⟩`. An atom is also considered a kind of unit, but it's not a unit array.
Atoms are displayed as plain values, while enclosed atoms, that is, depth-1 unit arrays, are shown with an array display.
@@ -25,7 +25,7 @@ In addition to numbers and characters, functions, 1-modifiers, and 2-modifiers a
Plus ← +
≡ plus
-The primitives that return a single number, like Rank (`=`), Length (`≠`), and Match (`≡`), give it as an atom, not an array.
+The primitives that return a single number, like Rank (`=`), Length (`≠`), and [Match](match.md) (`≡`), give it as an atom, not an array.
≡ "abc"
≡ ≡ "abc" # The result was an atom
diff --git a/doc/couple.md b/doc/couple.md
index f78d441c..e88acb75 100644
--- a/doc/couple.md
+++ b/doc/couple.md
@@ -30,7 +30,7 @@ In all cases what these functions do is more like reinterpreting existing data t
⥊ ⥊¨ a
∾ ⥊ ⥊¨ a
-The way this happens, and the constraint that all inner arrays have the same shape, is closely connected to the concept of an array, and like Table `⌜`, Merge might be considered a fundamental way to build up multidimensional arrays from lists. In both cases rank-0 or unit arrays are somewhat special. They are the identity element of a function with Table, and can be produced by Merge inverse, `>⁼` **on a list**, which forces either the outer or inner shape to be empty (BQN chooses `>⁼` to be `<`, but only on an array, as `>` cannot produce non-arrays). Merge has another catch as well: it cannot produce arrays with a `0` in the shape, except at the end, without some sort of prototype system.
+The way this happens, and the constraint that all inner arrays have the same shape, is closely connected to the concept of an array, and like [Table](map.md#table) `⌜`, Merge might be considered a fundamental way to build up multidimensional arrays from lists. In both cases rank-0 or [unit](enclose.md#whats-a-unit) arrays are somewhat special. They are the [identity value](fold.md#identity-values) of a function with Table, and can be produced by Merge inverse, `>⁼` **on a list**, which forces either the outer or inner shape to be empty (BQN chooses `>⁼` to be `<`, but only on an array, as `>` cannot produce non-arrays). Merge has another catch as well: it cannot produce arrays with a `0` in the shape, except at the end, unless fills can be specified.
⊢ e ← ⟨⟩¨ ↕3
≢ > e
@@ -40,7 +40,7 @@ Above we start with a list of three empty arrays. After merging once we get a sh
## Coupling units
-A note on the topic of Solo and Couple applied to units. As always, one axis will be added, so that the result is a list (strangely, J's [laminate](https://code.jsoftware.com/wiki/Vocabulary/commaco#dyadic) differs from Couple in this one case, as it will add an axis to get a shape `2‿1` result). For Solo, this is interchangeable with Deshape (`⥊`), and either primitive might be chosen for stylistic reasons. For Couple, it is equivalent to Join-to (`∾`), but this is an irregular form of Join-to because it is the only case where Join-to adds an axis to both arguments instead of just one. Couple should be preferred in this case.
+A note on the topic of Solo and Couple applied to units. As always, one axis will be added, so that the result is a list (strangely, J's [laminate](https://code.jsoftware.com/wiki/Vocabulary/commaco#dyadic) differs from Couple in this one case, as it will add an axis to get a shape `2‿1` result). For Solo, this is interchangeable with [Deshape](reshape.md) (`⥊`), and either primitive might be chosen for stylistic reasons. For Couple, it is equivalent to [Join-to](join.md) (`∾`), but this is an irregular form of Join-to because it is the only case where Join-to adds an axis to both arguments instead of just one. Couple should be preferred in this case.
The pair function, which creates a list from its arguments, can be written `Pair ← ≍○<`, while `≍` in either valence is `>∘Pair`. As an interesting consequence, `≍ ←→ >∘≍○<`, and the same relationship holds for `Pair`.
diff --git a/doc/depth.md b/doc/depth.md
index df05c7c6..236e1645 100644
--- a/doc/depth.md
+++ b/doc/depth.md
@@ -50,7 +50,7 @@ To find the depth of an array, use Depth (`≡`). For example, the depth of a li
≡ 2‿3‿4
≡ "a string is a list of characters"
-Depth is somewhat analogous to an array's rank `=𝕩`, and in fact rank can be "converted" to depth by splitting rows with `<⎉1`, reducing the rank by 1 and increasing the depth. Unlike rank, Depth doesn't care at all about its argument's shape:
+Depth is somewhat analogous to an array's [rank](shape.md) `=𝕩`, and in fact rank can be "converted" to depth by splitting rows with `<⎉1`, reducing the rank by 1 and increasing the depth. Unlike rank, Depth doesn't care at all about its argument's shape:
≡ 3‿4⥊"characters"
≡ (1+↕10)⥊"characters"
@@ -86,12 +86,12 @@ Several primitive functions use the left argument to manipulate the right argume
| 0 | `↑↓↕⌽⍉`
| 1 | `/⊏⊔`
-Functions such as Take and Drop use a single number per axis. When the left argument is a list of numbers, they apply to initial axes. But for convenience, a single number is also accepted, and applied to the first axis only. This is equivalent to ravelling the left argument before applying the function.
+Functions such as [Take and Drop](take.md) use a single number per axis. When the left argument is a list of numbers, they apply to initial axes. But for convenience, a single number is also accepted, and applied to the first axis only. This is equivalent to [deshaping](reshape.md) the left argument before applying the function.
≢2↑7‿7‿7‿7⥊"abc"
≢2‿1‿1↑7‿7‿7‿7⥊"abc"
-In these cases the flexibility seems trivial because the left argument has depth 1 or 0: it is an array or isn't, and it's obvious what a plain number should do. But for the second row in the table, the left argument is always an array. The general case is that the left argument is a vector and its elements correspond to right argument axes:
+In these cases the flexibility seems trivial because the left argument has depth 1 or 0: it is an array or isn't, and it's obvious what a plain number should do. But for the second row in the table, the left argument is always an array. The general case ([Select](select.md) below) is that the left argument is a list and its elements correspond to right argument axes:
⟨3‿2,1‿4‿1⟩ ⊏ ↕6‿7
@@ -99,7 +99,7 @@ This means the left argument is homogeneous of depth 2. What should an argument
⟨3‿2,1⟩ <⍟(0=≡)¨⊸⊏ ↕6‿7
-While very consistent, this extension represents a small convenience and makes it difficult to act on a single axis, which for Replicate and [Group](group.md) is probably the most common way the primitive is used:
+While very consistent, this extension represents a small convenience and makes it difficult to act on a single axis, which for [Replicate](replicate.md) and [Group](group.md) is probably the most common way the primitive is used:
3‿2‿1‿2‿3 / "abcde"
@@ -111,24 +111,24 @@ For Select, the depth-1 case is still quite useful, but it may also be desirable
## The Depth modifier
-The Depth 2-modifier (`⚇`) is a generalization of Each that allows diving deeper into an array. To illustrate it we'll use a shape `4‿3` array of lists of lists.
+The Depth 2-modifier (`⚇`) is a generalization of [Each](map.md) that allows diving deeper into an array. To illustrate it we'll use a shape `4‿3` array of lists of lists.
⊢ n ← <⎉1⍟2 4‿3‿2‿2⥊↕48
≡ n
-Reversing n swaps all the rows:
+Reversing `n` swaps all the rows:
⌽ n
-Depth `¯1` is equivalent to Each, and reverses the larger vectors, while depth `¯2` applies Each twice to reverse the smaller vectors:
+Depth `¯1` is equivalent to Each, and reverses the larger lists, while depth `¯2` applies Each twice to reverse the smaller lists:
⌽⚇¯1 n
⌽⚇¯2 n
-While a negative depth tells how many levels to go down, a non-negative depth gives the maximum depth of the argument before applying the left operand. On a depth-3 array like above, depth `2` is equivalent to `¯1` and depth `1` is equivalent to `¯2`. A depth of `0` means to descend all the way to the level of atoms, that is, apply [pervasively](https://aplwiki.com/wiki/Pervasion), like an arithmetic function.
+While a negative depth tells how many levels to go down, a non-negative depth gives the maximum depth of the argument before applying the left operand. On a depth-3 array like above, depth `2` is equivalent to `¯1` and depth `1` is equivalent to `¯2`. A depth of `0` means to descend all the way to the level of atoms, that is, apply [pervasively](arithmetic.md#pervasion), like an arithmetic function.
⟨'a',"bc"⟩ ≍⚇0 ⟨2‿3,4⟩
-With a positive operand, Depth doesn't have to use the same depth everywhere. Here, Length is applied as soon as the depth for a particular element is 1 or less, including if the argument has depth 0. For example, it maps over `⟨2,⟨3,4⟩⟩`, but not over `⟨11,12⟩`, even though these are elements of the same array.
+With a positive operand, Depth doesn't have to use the same depth everywhere. Here, [Length](shape.md) is applied as soon as the depth for a particular element is 1 or less, including if the argument has depth 0. For example, it maps over `⟨2,⟨3,4⟩⟩`, but not over `⟨11,12⟩`, even though these are elements of the same array.
≠⚇1 ⟨1,⟨2,⟨3,4⟩⟩,⟨5,⟨6,7⟩,⟨8,9,10⟩⟩,⟨11,12⟩⟩
diff --git a/doc/fold.md b/doc/fold.md
index 8e8d17a0..e27b7f02 100644
--- a/doc/fold.md
+++ b/doc/fold.md
@@ -74,7 +74,7 @@ Folding over a list of length 1 never calls the operand function: it returns the
!´ ⟨⎊⟩
-Folding over a list of two values applies `𝔽` once, since `𝔽` is always called on two arguments. But what about zero values? Should `𝔽` be applied minus one times? Sort of. BQN checks to see if it knows an *identity value* for the operand function, and returns that, never calling the function. This works for the arithmetic functions we showed above, always returning a single number.
+Folding over a list of two values applies `𝔽` once, since `𝔽` is always called on two arguments. But what about zero values? Should `𝔽` be applied minus one times? Sort of. BQN checks to see if it knows an *identity value* for the operand function, and returns that, never calling the function. This works for the [arithmetic functions](arithmetic.md) we showed above, always returning a single number.
+´ ⟨⟩ # Add nothing up, get zero
⌈´ ⟨⟩ # The smallest number
@@ -94,15 +94,15 @@ The full list of identity values Fold has to use is shown below.
### Right-to-left
-The functions we've shown so far are associative (ignoring floating point imprecision), meaning it's equally valid to combine elements of the argument list in any order. But it can be useful to fold using a non-associative function. In this case you must know that Fold performs a *right fold*, starting from the array and working towards the beginning.
+The functions we've shown so far are associative (ignoring floating point imprecision), meaning it's equally valid to combine elements of the argument list in any order. But it can be useful to fold using a non-associative function. In this case you must know that Fold performs a *right fold*, starting from the end of the array and working towards the beginning.
≍○<´ "abcd"
'a' ≍○< 'b' ≍○< 'c' ≍○< 'd' # Expanded form
-Using the pair function `≍○<` as an operand shows the structure nicely. This fold first pairs the final two characters `'c'` and `'d'`, then pairs `'b'` with that and so on. This matches BQN's right-to-left order of evaluation. More declaratively we might say that each character is paired with the result of folding over everything to its right.
+Using the [pair](couple.md#coupling-units) function `≍○<` as an operand shows the structure nicely. This fold first pairs the final two characters `'c'` and `'d'`, then pairs `'b'` with that and so on. This matches BQN's right-to-left order of evaluation. More declaratively we might say that each character is paired with the result of folding over everything to its right.
-BQN doesn't provide a left Fold (`` ` `` is Scan). However, you can fold from the left by reversing (`⌽`) the argument list and also reversing (`˜`) the operand function's argument order.
+BQN doesn't provide a left Fold (`` ` `` is [Scan](scan.md)). However, you can fold from the left by [reversing](reverse.md#reverse) (`⌽`) the argument list and also reversing (`˜`) the operand function's argument order.
≍○<˜´ ⌽ "abcd"