Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions nbs/autodiff.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

```bpl
⊼∂3 ⍝ 6
(+/⊼)∂ 1 2 3 ⍝ 2 4 6
+/⊼ ∂ 1 2 3 ⍝ 2 4 6
```

The [`∂` page](glyphs/partial.qmd) lists what `∂` differentiates and the errors it gives.
Expand Down Expand Up @@ -96,10 +96,10 @@ ste←{⌊ω} ◇ ste∂←{α}
{+/steω×2}∂ 1.5 2.5 ⍝ 2 2
```

`•detach X` gives `X` with every derivative removed. `∂` then treats it as a constant, as JAX treats the result of `stop_gradient`. `⊢וdetach` multiplies its argument by a detached copy of itself. Its derivative at 3 is the copy's value, 3, where `⊼∂3` gives 6:
`•detach X` gives `X` with every derivative removed. `∂` then treats it as a constant, as JAX treats the result of `stop_gradient`. `×↢•detach` multiplies its argument by a detached copy of itself. Its derivative at 3 is the copy's value, 3, where `⊼∂3` gives 6:

```bpl
(⊢וdetach)∂3 ⍝ 3
×↢•detach ∂3 ⍝ 3
```

A value that `f` writes to a name outside itself loses its derivatives when `∂` returns. A function gives the same values with and without `∂`.
Expand Down Expand Up @@ -144,11 +144,11 @@ sq←{+/⊼ω} ◇ g←sq∂ 1 2 3

The second call replays the program that the first call built. Four numbers need a program of their own.

A dfn keeps its programs with its definition. Any other function, such as a train, keeps them by its structure for the rest of the session. The structure leaves out the arrays that the function binds, which become inputs, as a dfn's free names do. So `+/w×⊢` replays its program when `w` holds new values of the same type and shape:
A dfn keeps its programs with its definition. Any other function, such as a train, keeps them by its structure for the rest of the session. The structure leaves out the arrays that the function binds, which become inputs, as a dfn's free names do. So `+/w×` replays its program when `w` holds new values of the same type and shape:

```bpl
w←1 2 3 ◇ g←(+/w×⊢)∂ 4 5 6
w←7 8 9 ◇ (•explain "(+/w×⊢)∂ 4 5 6").programs.event ⍝ ["replayed"]
w←1 2 3 ◇ g←+/w× ∂ 4 5 6
w←7 8 9 ◇ (•explain "+/w× ∂ 4 5 6").programs.event ⍝ ["replayed"]
```

### What stops a trace
Expand Down
2 changes: 1 addition & 1 deletion nbs/comparison.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ a +˝∘×⎉1‿∞ b

```bpl
a←2 3ρι6ₓ ◇ b←3 2ρι6ₓ
a (+⌿×)⍤1 ∞ b ⍝ [10 13◇28 40]ₓ
a +⌿×∘⍤1 ∞ b ⍝ [10 13◇28 40]ₓ
```

### A vector bound into a composition
Expand Down
38 changes: 25 additions & 13 deletions nbs/composition.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ v←2 4 9 ◇ +/÷≢ v ⍝ 5
v←2 4 9 ◇ +/÷≢v ⍝ 0ₓ
```

## Operators on trains

Before an operator, `∘` finishes the current run as that operator's left operand. `⊂⊢∘⌸` is `(⊂⊢)⌸`, and `+/÷≢∘⍤1` is `(+/÷≢)⍤1`. The right operand of a dyadic operator follows as usual:

```bpl
m←2 3ρι6 ◇ +/÷≢∘⍤1m ⍝ 1 4
```

The boundary includes the whole run on its left. Keep a left argument or an earlier function outside that run with spaces or parentheses. Named operators work the same way as glyphs. Before a function, `∘` remains [Atop](#atop-and-over).

## Identity functions

In a train, `⊢` stands for the right argument and `⊣` for the left. A fork with `⊢` reads well where the argument appears once. `⊢÷+/` divides each item by the sum:
Expand All @@ -45,12 +55,14 @@ n←⊽⁻+÷ ◇ n 1.5 ⍝ 1.416666667

## Atop and Over

[Atop](glyphs/jot.qmd), `f∘g`, applies `g` and then `f`. `X f∘g Y` is `f(X g Y)`. `⌊∘÷` divides, then rounds down:
The two-function train `⌊÷` divides, then rounds down:

```bpl
7 ⌊∘÷ 2 ⍝ 3ₓ
7 ⌊÷ 2 ⍝ 3ₓ
```

[Atop](glyphs/jot.qmd), `∘`, writes this composition explicitly. `f∘g` applies `g` and then `f`, as the train `f g` does. `X f∘g Y` is `f(X g Y)`.

[Over](glyphs/circle-diaeresis.qmd), `f⍥g`, applies `g` to each argument before `f`. `X f⍥g Y` is `(g X)f(g Y)`. `=⍥≢` tests whether two lists have the same length:

```bpl
Expand Down Expand Up @@ -95,20 +107,20 @@ x←3 ◇ x² ⍝ 9
fahrenheit←32+1.8× ◇ fahrenheit⁻ 212 ⍝ 100
```

A superscript straight after a number applies to the number. To invert a function that ends in a number, put the function in parentheses:
A superscript straight after a number applies to the number. To invert a function that ends in a number, finish the function before `⁻`:

```bpl
(+↢3)⁻ 10 ⍝ 7
+↢3∘⁻10 ⍝ 7
```

Without the parentheses, `+↢3⁻` tries to invert the number `3`, which is a `DOMAIN` error. A space also groups the bound function: `+↢3 ⁻ 10` gives `7`. The signed superscript `3⁻¹` still means one third; `f⁻¹` on a function now means rank ¯1.
`(+↢3)⁻10` and `+↢3 ⁻ 10` also give `7`. Without a boundary, `+↢3⁻` tries to invert the number `3`, which is a `DOMAIN` error. The signed superscript `3⁻¹` still means one third; `f⁻¹` on a function now means rank ¯1.

## Under

[Under](glyphs/at.qmd), `f@g`, applies `f` to what `g` selects and writes the result back. `(10×)@[1 3]` multiplies items 1 and 3 by 10. `⌊@(10×)` rounds down to tenths: it scales by 10, rounds down, then scales back.
[Under](glyphs/at.qmd), `f@g`, applies `f` to what `g` selects and writes the result back. `10×∘@[1 3]` multiplies items 1 and 3 by 10. `⌊@(10×)` rounds down to tenths: it scales by 10, rounds down, then scales back.

```bpl
(10×)@[1 3] 1 2 3 4 ⍝ 1 20 3 40
10×∘@[1 3] 1 2 3 4 ⍝ 1 20 3 40
⌊@(10×)1.25 2.78 ⍝ 1.2 2.7
```

Expand All @@ -122,8 +134,8 @@ Within a run, an operator's right operand is the one [token](terms.qmd#term-toke
≥⍣3⁝5 ⍝ 8
m←["r":2 "c":3]ρι6ₓ ◇ i←"c" ◇ +/⍠i⁝m ⍝ ["r":2]ρ[3 12]ₓ
m←["r":2 "c":3]ρι6ₓ ◇ i←"c" ◇ 10÷√1++/⍠i⁝m ⍝ ["r":2]ρ[5 2.773500981]
(2×)⍣3⁝5 ⍝ 40
(+/÷≢)⍤1⁝2 3ρι6 ⍝ 1 4
2×∘⍣3⁝5 ⍝ 40
+/÷≢∘⍤1⁝2 3ρι6 ⍝ 1 4
```

Add no separator where the tokens already stay distinct. A name never joins a literal strand, as in `f⍣n1`. A vector argument can touch its operand in brackets, as in `≥⍣2[1 2 3]`.
Expand All @@ -133,19 +145,19 @@ Add no separator where the tokens already stay distinct. A name never joins a li
```bpl
w←[1 2◇3 4◇5 6] ◇ 10 20+⍤1⁝w ⍝ [11 22◇13 24◇15 26]
w←[1 2◇3 4◇5 6] ◇ 10 20(+⍤1)w ⍝ [11 22◇13 24◇15 26]
m←2 3ρι6 ◇ (+/÷≢)⍤1m ⍝ 1 4
m←2 3ρι6 ◇ +/÷≢∘⍤1m ⍝ 1 4
```

## Forms that read worse

Each pair gives the same result.
Each pair gives the same result with one argument.

| Reads worse | Reads better |
|---|---|
| `{(+/ω)÷≢ω}` | `+/÷≢` |
| `0.5×⊢+2÷⊢` | `⊽⁻+÷` |
| `{ω÷+/ω}` | `⊢÷+/` |
| `{ω×10}@[1 3]` | `(10×)@[1 3]` |
| `{ω÷+/ω}` | `÷↢ +/` |
| `{ω×10}@[1 3]` | `10×∘@[1 3]` |
| `{+/ω}⍠0` | `+/₀` |
| `{ω,1}` | `,↢1` |
| `×⍨x` | `x²` |
Expand Down
2 changes: 1 addition & 1 deletion nbs/data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1011,7 +1011,7 @@
}
],
"source": [
"words←' '(≠⊆⊢)\"to be or not to be\"\n",
"words←' ' ≠⊆⊢ \"to be or not to be\"\n",
"u←∪words\n",
"words←[uιwords]⌷u\n",
"words"
Expand Down
2 changes: 2 additions & 0 deletions nbs/evaluation.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ Operators bind before functions apply. An operator's left [operand](terms.qmd#te

Each run counts as one token, as a parenthesised group does. An operator at the end of a run takes the next run as its right operand, as it takes a touching token: in `⌊@ 10× x`, the right operand of `@` is the run `10×`. An operator at the start of a run takes the previous run as its left operand: in `≢⊢ ⌸x`, the left operand of `⌸` is the run `≢⊢`. Names that hold operators count in both places.

Before an operator, `∘` finishes the whole current run as its left operand: `⊂⊢∘⌸` is `(⊂⊢)⌸`. Spaces keep earlier functions and left arguments outside that run. Before a function, `∘` remains Atop. [Operators on trains](composition.qmd#operators-on-trains) gives examples.

```bpl
m←2 3ρι6ₓ ◇ +/⍤1 m ⍝ [3 12]ₓ
m←2 3ρι6ₓ ◇ +/⍤1m ⍝ [3 12]ₓ
Expand Down
4 changes: 2 additions & 2 deletions nbs/glyphs/at.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ When a function `g` returns items of `Y` that selecting primitives took, `f@g Y`
+\@∊ [3 1 0] [2 5] ⍝ [[3 4 4] [6 11]]
9@↑ 1 2 3 ⍝ 9 2 3
-@ 1↓⍣2 [1 2 3 4] ⍝ 1 2 ¯3 ¯4
(ι≢)@< 30 10 20 ⍝ [2 0 1]ₓ
(1+)@{ω>15 # ω} 10 20 30 ⍝ 10 21 31
ι≢∘@< 30 10 20 ⍝ [2 0 1]ₓ
1+∘@{ω>15 # ω} 10 20 30 ⍝ 10 21 31
```

`g` may select a keyed or unkeyed position more than once. Which replacement that position keeps isn't promised. The updated array retains its keys. A write at a fill position is dropped.
Expand Down
4 changes: 2 additions & 2 deletions nbs/glyphs/circle-star.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Uses complex logarithms where needed. `⊛0` is `¯∞`. `1⊛1` gives zero when

```bpl
2⊛⁻3 ⍝ 8
(⊛↢8)⁻3 ⍝ 2
⊛↢8∘⁻3 ⍝ 2
```

## Fast combinations
Expand All @@ -33,7 +33,7 @@ BPL computes this combination by an algorithm of its own, in any spelling. [Trai

| Combination | Applies to | Benefit |
|---|---|---|
| `⊛1+Y`, `⊛Y+1` or `⊛∘(1+)` | real `Y` | log1p keeps the digits of a small `Y` that `1+Y` rounds away |
| `⊛1+Y`, `⊛Y+1`, `⊛1+` or `⊛∘(1+)` | real `Y` | log1p keeps the digits of a small `Y` that `1+Y` rounds away |

At an item below ¯1 under dynamic kinds, and on complex numbers, `⊛1+Y` computes `⊛` of `1+Y`. Softplus, `⊛1+*Y`, stays accurate for a very negative `Y`:

Expand Down
2 changes: 1 addition & 1 deletion nbs/glyphs/comma.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ x,⍤0 y ⍝ [1 3◇2 4]
```bpl
,⁻1 2 3 ⍝ 1 2 3
1 2,⁻1 2 3 4 ⍝ 3 4
(,↢3 4)⁻1 2 3 4 ⍝ 1 2
,↢3 4∘⁻1 2 3 4 ⍝ 1 2
```
8 changes: 4 additions & 4 deletions nbs/glyphs/dot.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,18 @@ m.[⍸m>9] ⍝ [10 11]ₓ

After a function, `.name` and `.[I]` read from the function's result, as they read from an array: `f.name` is `{(α f ω).name}`, and `f.[I]` is `{(α f ω).[I]}`, with one argument or two. A path goes on from there, as in `⊢.x.[0]`. A name that holds a function, or a path to one, gives an inner product instead, as in `+.ops.mul`. [Under](at.qmd) writes back through the read.

`.[I]` by itself is a selector function, equivalent to `⊢.[I]`. Ordinary operators can modify it: `.[I]¨` selects from each item.

```bpl
v←10 20 30 40
⊢.[[1 3]] v ⍝ 20 40
.[[1 3]] v ⍝ 20 40
1 2 3 4 +.[[0 2]] v ⍝ 11 33
(10×)@ ⊢.[[1 3]] v ⍝ 10 200 30 400
10×∘@.[[1 3]]v ⍝ 10 200 30 400
T←["a":1 "x":[10 20 30]]
⊢.a¨[T T] ⍝ 1 1
⊢.x.[[2 0]] T ⍝ 30 10
```

`.[I]` by itself is a selector function, equivalent to `⊢.[I]`. Ordinary operators can modify it: `.[I]¨` selects from each item.

`T.<operators>[I]` applies those operators to the selector before calling it on `T`. The first bracket at the current level starts the selectors. Parentheses and dfns keep their contents together. Put a bracket-valued operator operand in parentheses, as in `T.⍤([0 1])[I]`. Numeric superscripts specify Rank in this position.

```bpl
Expand Down
6 changes: 3 additions & 3 deletions nbs/glyphs/jot-diaeresis.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ v←[[1 2] [3 4 5]]
-⍤0⁝5 ⍝ ¯5
```

With rank `∞`, the cell is the whole argument, and rank `¯∞` is rank 0. For example, `⍤1 ∞` pairs each row on the left with the whole right argument. In the examples below, `(+⌿×)⍤1 ∞` is the matrix-vector product. With a matrix on the right, the same function multiplies matrices.
With rank `∞`, the cell is the whole argument, and rank `¯∞` is rank 0. For example, `⍤1 ∞` pairs each row on the left with the whole right argument. In the examples below, `+⌿×∘⍤1 ∞` is the matrix-vector product. `∘` gives Rank the whole train `+⌿×` as its left operand. With a matrix on the right, the same function multiplies matrices.

```bpl
m←[1 2 3◇4 5 6]
m (+⌿×)⍤1 ∞ [1 2 3] ⍝ 14 32
m (+⌿×)⍤1 ∞ [1 10◇2 20◇3 30] ⍝ [14 140◇32 320]
m +⌿×∘⍤1 ∞ [1 2 3] ⍝ 14 32
m +⌿×∘⍤1 ∞ [1 10◇2 20◇3 30] ⍝ [14 140◇32 320]
```

A function right operand computes the ranks from the arguments, as BQN's `⎉` does: `f⍤g Y` is `f⍤(g Y) Y`, and `X f⍤g Y` is `X f⍤(X g Y) Y`. [Axis](quad-colon.qmd) and [Stencil](quad-diamond.qmd) take a function right operand in the same way. Here each cell of `Y` with the rank of `X` pairs with `X`:
Expand Down
10 changes: 10 additions & 0 deletions nbs/glyphs/jot.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ Dyadic operator. Keys: `Alt-t`. Hanzi: `承`
```
See [Rank](jot-diaeresis.qmd) for applying a function to cells of a chosen rank.

## Before an operator

`∘` before an operator finishes the current run as its left operand. `⊂⊢∘⌸` is `(⊂⊢)⌸`; `+/÷≢∘⍤1` applies the mean train at rank 1. Named operators have the same behavior. Spaces or parentheses keep any earlier function or left argument outside the run.

```bpl
m←2 3ρι6 ◇ +/÷≢∘⍤1m ⍝ 1 4
```

Before a function, `∘` still means Atop. [Composing functions](../composition.qmd#operators-on-trains) describes both uses.

## Inverse

`(f∘g)⁻Y` is `g⁻ f⁻ Y`. `X(f∘g)⁻Y` is `X g⁻ f⁻ Y`.
Expand Down
4 changes: 2 additions & 2 deletions nbs/glyphs/left-tail-arrow.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ See [Before](right-tail-arrow.qmd), [Atop / Rank](jot-diaeresis.qmd) and [Over](
With an array operand, `(f↢X)⁻Y` inverts `f` with `X` fixed on the right. With two functions, `X(f↢g)⁻Y` inverts `f` with `X` fixed, then applies `g⁻`. The hook `(×↢*)⁻` gives the Lambert W function.

```bpl
(-↢3)⁻7 ⍝ 10
(×↢*)⁻1 ⍝ 0.567143290409784
-↢3∘⁻7 ⍝ 10
×↢*∘⁻1 ⍝ 0.567143290409784
```
2 changes: 1 addition & 1 deletion nbs/glyphs/minus.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ Characters shift by code point. Character differences are exact integers.

```bpl
10-⁻3 ⍝ 7
(-↢3)⁻7 ⍝ 10
-↢3∘⁻7 ⍝ 10
```
2 changes: 1 addition & 1 deletion nbs/glyphs/obelus.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ An integer divided by zero gives the integer limit of its sign: i64's under dyna

```bpl
12÷⁻4 ⍝ 3
(÷↢4)⁻3 ⍝ 12
÷↢4∘⁻3 ⍝ 12
```

## Errors
Expand Down
4 changes: 2 additions & 2 deletions nbs/glyphs/partial.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Monadic operator. Keys: `Alt-f`. Hanzi: `导/梯` (`導/梯`)

```bpl
⊼∂3 ⍝ 6
(+/⊼)∂ 1 2 3 ⍝ 2 4 6
+/⊼ ∂ 1 2 3 ⍝ 2 4 6
cart←{[r t]←ω ◇ [r×2○t r×1○t]} ◇ -.×cart∂ 2 0.5 ⍝ 2
3 {α×ω×ω}∂ 2 ⍝ 12
```
Expand All @@ -15,7 +15,7 @@ cart←{[r t]←ω ◇ [r×2○t r×1○t]} ◇ -.×cart∂ 2 0.5 ⍝ 2

```bpl
⊼∂3ₓ ⍝ 6
p←["a":1 "b":2] ◇ (⊢.a×⊢.b)∂ p ⍝ ["a":2 "b":1]
p←["a":1 "b":2] ◇ ⊢.a×⊢.b∘∂ p ⍝ ["a":2 "b":1]
-∂3ₓ₁ ⍝ ¯1ₛ
```

Expand Down
2 changes: 1 addition & 1 deletion nbs/glyphs/pi.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ Use [`○`](circle.qmd) to turn an angle into a unit-circle point.
```bpl
π⁻π2 ⍝ 2
2π⁻4 ⍝ π0.5
(π↢2)⁻4 ⍝ 8÷π1
π↢2∘⁻4 ⍝ 8÷π1
```
8 changes: 5 additions & 3 deletions nbs/glyphs/quad-equal.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ BPL computes each of these combinations by an algorithm of its own, in any spell
| `≢⊢ ⌸Y` or `K (≢⊢)⌸Y` | any keys | counts each group's major cells without building the groups |
| `K (f/⊢)⌸Y` or `K (f⌿⊢)⌸Y`, with `f` of `+ ⌈ ⌊`, or `×` of floats | a vector `Y` of floats, integers or Booleans | folds every group in one pass, without a call of the operand for each group |

`∘` also gives Key a whole train as its operand, as in `≢⊢∘⌸Y` or `K +/⊢∘⌸ Y`.

```bpl
≢⊢ ⌸"banana" ⍝ [1 3 2]ₓ
1 1 2(+/⊢)⌸10 20 30 ⍝ 30 30
(•explain "1 1 2(+/⊢)⌸10 20 30").fast.rule ⍝ ["group folds"]
≢⊢∘⌸"banana" ⍝ [1 3 2]ₓ
1 1 2 +/⊢∘⌸ 10 20 30 ⍝ 30 30
(•explain "1 1 2 +/⊢∘⌸ 10 20 30").fast.rule ⍝ ["group folds"]
```
2 changes: 1 addition & 1 deletion nbs/glyphs/radical.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Function. Keys: `Alt-3`. Hanzi: `根`. Ranks: `0` monadic, `0 0` dyadic
```bpl
√⁻3 ⍝ 9
3√⁻2 ⍝ 8
(√↢8)⁻2 ⍝ 3
√↢8∘⁻2 ⍝ 3
```

## Errors
Expand Down
2 changes: 1 addition & 1 deletion nbs/glyphs/right-tail-arrow.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ See [After](left-tail-arrow.qmd), [Atop / Rank](jot-diaeresis.qmd) and [Over](ci
With an array operand, `(X↣f)⁻Y` is `X f⁻ Y`. With two functions, `X(f↣g)⁻Y` inverts `g` with `f X` fixed on the left.

```bpl
(2↣×)⁻6 ⍝ 3
2↣×∘⁻6 ⍝ 3
3(-↣+)⁻7 ⍝ 10
```
2 changes: 1 addition & 1 deletion nbs/glyphs/star.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ See also function [power `⍣`](star-diaeresis.qmd).

```bpl
2*⁻8 ⍝ 3
(*↢2)⁻9 ⍝ 3
*↢2∘⁻9 ⍝ 3
```

## Fast combinations
Expand Down
4 changes: 2 additions & 2 deletions nbs/glyphs/superscript-minus.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Monadic operator. Keys: `Alt-_`. Hanzi: `反`
```bpl
*⁻1 ⍝ 0
2×⁻10 ⍝ 5
(+↢3)⁻10 ⍝ 7
+↢3∘⁻10 ⍝ 7
```

BPL infers inverses of the primitives and compositions listed under [Power](star-diaeresis.qmd). `f⁻←g` [attaches an inverse](../assignment.ipynb#inverses-and-derivatives) to a named function.
Expand All @@ -18,6 +18,6 @@ The minus is bare: no superscript digit follows it. `f⁻¹` means [Rank](jot-di
⌽⁻ ¹[1 2◇3 4] ⍝ [2 1◇4 3]
```

An inverse applies to the whole derived function on its left. Use parentheses or a space when that function ends in a number: `(+↢3)⁻10` or `+↢3 ⁻ 10`.
An inverse applies to the whole derived function on its left. Use `∘` before `⁻` when that function ends in a number: `+↢3∘⁻10`. Parentheses or a space also group the function: `(+↢3)⁻10` or `+↢3 ⁻ 10`.

Errors: `DOMAIN` for an unknown inverse or an array operand.
2 changes: 1 addition & 1 deletion nbs/glyphs/tricolon.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ h←- ◇ m←5 ◇ h⁝m ⍝ ¯5
≥⍣3⁝5 ⍝ 8
```

`h⁝m` is `h(m)`, and `≥⍣3⁝5` is `(≥⍣3)5`. A space also groups runs, as [Syntax](../syntax.qmd#runs) describes. `⁝` leaves the grouping unchanged. Parentheses still group compound operands and trains within a run. [Composing functions](../composition.qmd#separating-an-operand-from-its-argument) gives examples.
`h⁝m` is `h(m)`, and `≥⍣3⁝5` is `(≥⍣3)5`. A space also groups runs, as [Syntax](../syntax.qmd#runs) describes. `⁝` leaves the grouping unchanged. Before an operator, [`∘`](jot.qmd#before-an-operator) finishes the current run as its left operand. Parentheses still group compound operands and nested trains. [Composing functions](../composition.qmd#separating-an-operand-from-its-argument) gives examples.
2 changes: 1 addition & 1 deletion nbs/index-notation.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ heads←{h←0 2 1 3⍉ω ◇ (¯2↓ρh , ×/¯2↑ρh)ρh}
attn←{
[wqkv wo]←α
[q k v]←1 3 0 2 4⍉ω+.×wqkv
s←mask(+⍤2) q+.×⍤2⍉⍤2⁝k ÷ √⊢/ρq
s←mask(+⍤2) q+.×⍤2⍉⍤2⁝k ÷ √(ρq)₋₁
e←*s-⌈/s
(heads e÷+/e +.×⍤2 v)+.×wo
}
Expand Down
6 changes: 3 additions & 3 deletions nbs/indexing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -985,15 +985,15 @@
}
],
"source": [
"(10×)@[1 3]u"
"10×∘@[1 3]u"
]
},
{
"cell_type": "markdown",
"id": "2f2d7b49",
"metadata": {},
"source": [
"After a function, `.[I]` selects from its result. Under can use `⊢.[I]` as its selector, with no dfn:"
"After a function, `.[I]` selects from its result. Standalone `.[I]`, equivalent to `⊢.[I]`, builds a selector function that Under can use directly:"
]
},
{
Expand All @@ -1013,7 +1013,7 @@
}
],
"source": [
"(10×)@ ⊢.[[1 3]] u"
"10×∘@.[[1 3]] u"
]
},
{
Expand Down
Loading