aboutsummaryrefslogtreecommitdiff
path: root/doc/hook.md
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2022-05-28 21:55:15 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2022-05-28 21:55:15 -0400
commit18d1bce85de22f8bc7a08453618c7d9e94b61f92 (patch)
tree87226d2fe5238c87079520db1a4f052740382f1c /doc/hook.md
parentbd4209a653a68929a9fb1a215bbc3e34a393e753 (diff)
Editing
Diffstat (limited to 'doc/hook.md')
-rw-r--r--doc/hook.md12
1 files changed, 6 insertions, 6 deletions
diff --git a/doc/hook.md b/doc/hook.md
index 368d3854..94b301d3 100644
--- a/doc/hook.md
+++ b/doc/hook.md
@@ -19,7 +19,7 @@ The "hook" combinators Before and After serve a few purposes in BQN. The importa
## Description
-In the general case, I think of Before as using `𝔽` as a preprocessing function applied to `𝕨` (when there are two arguments) and After as using `𝔾` as preprocessing for `𝕩`. Then the other operand is called on the result and remaining argument. Here are some simple calls with Pair (`⋈`): the result is a pair that corresponds to `𝕨‿𝕩`, but one or the other result has been modified by the pointy-side function.
+In the general case, I think of Before as using `𝔽` as a preprocessing function applied to `𝕨` (when there are two arguments), and After as using `𝔾` as preprocessing for `𝕩`. Then the other operand is called on the result and remaining argument. Here are some simple calls with [Pair](pair.md) (`⋈`): the result is a pair that corresponds to `𝕨‿𝕩`, but one or the other result has been modified by the pointy-side function.
9 √⊸⋈ 2
@@ -33,7 +33,7 @@ This can be used to make a "filter" pattern using [Replicate](replicate.md) (`/`
{𝕩<0}¨⊸/ 4‿¯2‿1‿¯3‿¯3
-As `<` is a pervasive function, there's no need for the Each (`¨`) in this case, and the clunky block function `{𝕩<0}` can also be written smaller with a combinator, as `<⟜0`. More on that in the next section…
+As `<` is a [pervasive](arithmetic.md#pervasion) function, there's no need for the Each (`¨`) in this case, and the clunky block function `{𝕩<0}` can also be written smaller with a combinator, as `<⟜0`. More on that in the next section…
<⟜0⊸/ 4‿¯2‿1‿¯3‿¯3
@@ -43,7 +43,7 @@ As `<` is a pervasive function, there's no need for the Each (`¨`) in this case
<⟜0 4‿¯2‿1‿¯3‿¯3
-If we expand `<⟜0 x`, we get `x < (0 x)`, which doesn't quite make sense. That's because `0` has a subject role, but `⟜` always applies its operands as functions. It's more accurate to use `x < (0{𝔽} x)`, or just skip ahead to `x < 0`.
+If we expand `<⟜0 x`, we get `x < (0 x)`, which doesn't quite make sense. That's because `0` has a subject [role](expression.md#syntactic-role), but `⟜` always applies its operands as functions. It's more accurate to use `x < (0{𝔽} x)`, or just skip ahead to `x < 0`.
Similar reasoning gives the following expansions:
@@ -54,7 +54,7 @@ Similar reasoning gives the following expansions:
Note that when there are two arguments, the constant "swallows" the one on the same side, so that the function is applied to the constant and the argument on the *opposite* side.
-As in a train, if you want to use a function as a constant then you need to be explicity about it, with the [Constant](constant.md) (`˙`) modifier.
+As in a train, if you want to use a function as a constant then you need to be explicit about it, with the [Constant](constant.md) (`˙`) modifier.
3 ⋈⟜(⌊˙)⊸⥊ 'a'+↕12
@@ -64,7 +64,7 @@ In the more extreme case of wanting a *modifier* operand, you might try `⋈⟜(
If you like to go [tacit](tacit.md), you'll likely end up stringing together a few `⊸`s and `⟜`s at times. Of course the effects are entirely determined by the left-to-right precedence rule for modifiers, but it's interesting to examine what happens in more detail.
-In the pattern `F⊸G⟜H`, the ordering doesn't matter at all! That is, it means `(F⊸G)⟜H`, but this is exactly the same function as `F⊸(G⟜H)`. In both cases, `F` is applied to `𝕨`, `H` is applied to `𝕩`, and `G` acts on both the results.
+In the pattern `F⊸G⟜H`, the ordering doesn't matter at all! That is, it means `(F⊸G)⟜H`, but this is the same function as `F⊸(G⟜H)`. In both cases, `F` is applied to `𝕨`, `H` is applied to `𝕩`, and `G` acts on both the results (the parentheses do change whether `F` or `H` is called first, which only matters if they have side effects).
4 -⊸⋈⟜⋆ 2
@@ -88,4 +88,4 @@ Here's a long example, that might show up if you want to [sort](order.md#sort) a
(⌊≠÷2˙)⊸⊑⊸≤⊸⊔ "quicksort" # Use to partition 𝕩
-Three is rare, but I use two `⊸`s all the time, as well as `⟜` followed by `⊸`, for example the `<⟜'a'⊸/` filter on the [front page](../README.md). I think a combination like `lots∘of○stuff⊸/ x` reads very nicely when moving from left to right. When I see `⊸/` I know that I'm filtering `x` and can read the rest with that context. The reason `⊸` that has all this power, but not `⟜`, has nothing to do with the modifiers themselves, as they're completely symmetrical. It's all in the way BQN defines modifier grammar, left to right.
+Three is rare, but I use two `⊸`s all the time, as well as `⟜` followed by `⊸`, for example the `<⟜'a'⊸/` filter on the [front page](../README.md). I think a combination like `lots∘of○stuff⊸/ x` reads very nicely when moving from right to left. When I see `⊸/` I know that I'm filtering `x` and can read the rest with that context. The reason `⊸` has all this power, but not `⟜`, has nothing to do with the modifiers themselves, as they're completely symmetrical. It's all in the way BQN defines modifier grammar, left to right.