diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2022-06-10 22:42:44 -0400 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2022-06-10 22:42:44 -0400 |
| commit | f469c6f9bd4c9cf3c2b8ce93c3f2331cdcdd589a (patch) | |
| tree | ac35ee6715ad4298bd725b4837631139f40ce122 /doc/swap.md | |
| parent | 189e020069d5225c349b15837a65dd08035c97aa (diff) | |
More editing
Diffstat (limited to 'doc/swap.md')
| -rw-r--r-- | doc/swap.md | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/doc/swap.md b/doc/swap.md index 0d9245e3..a6df2a29 100644 --- a/doc/swap.md +++ b/doc/swap.md @@ -13,18 +13,18 @@ Have the arguments to a function, but not in the right places? Self/Swap (`˜`) | Self | ` F˜𝕩` | `𝕩F𝕩` | Swap | `𝕨F˜𝕩` | `𝕩F𝕨` -Since `𝕩` is always the left argument, these two definitions can be unified as `{𝕩𝔽𝕨⊣𝕩}`, noting that [Left](identity.md) becomes a plain identity function when the left argument `𝕨` isn't given. +Since `𝕩` always becomes the left argument, these two definitions can be unified as `{𝕩𝔽𝕨⊣𝕩}`, noting that [Left](identity.md) returns `𝕨` if it's given and `𝕩` if not. -Swap is arguably less transformative. Some common examples are `-˜` and `÷˜`, since these two functions run the [wrong way](../commentary/problems.md#subtraction-division-and-span-are-backwards) for BQN's evaluation order. This is very often useful in [tacit](tacit.md) programming, and less useful for explicit code. While it sometimes allows for shorter code by making a pair of parentheses unnecessary (say, `(a×b)-c` is `c-˜a×b`), I personally don't think this is always a good idea. My opinion is that it should be used when it makes the semantics a better fit for BQN, but putting the primary argument on the right and a secondary or control argument on the left. +Swap is arguably less transformative. Some common examples are `-˜` and `÷˜`, since these two functions run the [wrong way](../commentary/problems.md#subtraction-division-and-span-are-backwards) for BQN's evaluation order. This is very often useful in [tacit](tacit.md) programming, and less needed for explicit code. While it sometimes allows for shorter code by making a pair of parentheses unnecessary (say, `(a×b)-c` is `c-˜a×b`), I personally don't think this is always a good idea. My opinion is that it should be used when it makes the semantics a better fit for BQN, but putting the primary argument on the right and a secondary or control argument on the left. 'a' ⋈˜ 'b' " +" ⊏˜ 0‿1‿1‿0‿0≍1‿0‿1‿0‿1 -Self re-uses one argument twice. In this way it's a little like [Over](compose.md), which re-uses one *function* twice. A common combination is with Table, `⌜˜`, so that the operand function is called on each combination of elements from the argument to form a square result. For example, `=⌜˜` applied to `↕n` gives the identity matrix of size `n`. +Moving on, Self re-uses one argument twice. In this way it's a little like [Over](compose.md), which re-uses one *function* twice. A common combination is with [Table](map.md#table), `⌜˜`, so that the operand function is called on each combination of elements in `𝕩` to form a square result. For example, `=⌜˜` applied to `↕n` gives the identity matrix of size `n`. ט 4 =⌜˜ ↕3 -Note that Self isn't needed with Before (`⊸`) and After (`⟜`), which essentially have a copy built in: for example `F⊸G 𝕩` is the same as `F⊸G˜ 𝕩` by definition. +Note that Self isn't needed with [Before](hook.md) (`⊸`) [and After](hook.md) (`⟜`), which essentially have a copy built in: for example `F⊸G 𝕩` is the same as `F⊸G˜ 𝕩` by definition. |
