diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2022-04-27 22:21:50 -0400 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2022-04-27 22:21:50 -0400 |
| commit | 31b722e16e6a0f6b0f08e8409b2c7e240937bfed (patch) | |
| tree | 409d3fde73f45aace8ce1c224dd7f5514f1ff4d0 /commentary | |
| parent | 3b44787d5b7508a5abd868c7891046576e0eab02 (diff) | |
Documentation for Under
Diffstat (limited to 'commentary')
| -rw-r--r-- | commentary/problems.md | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/commentary/problems.md b/commentary/problems.md index af37a869..36d7cc58 100644 --- a/commentary/problems.md +++ b/commentary/problems.md @@ -52,7 +52,7 @@ If you include multiple multi-line functions in what would otherwise be a one-li If you have the normal mix of monads and dyads you'll need a lot of parentheses and might end up abusing `⟜`. Largely solved with the Nothing syntax `·`, which acts like J's Cap (`[:`) in a train, but still a minor frustration. ### Under/bind combination is awkward -It's most common to use Under with dyadic structural functions in the form `…⌾(i⊸F)`, for example where `F` is one of `/` or `↑`. This is frustrating for two reasons: it requires parentheses, and it doesn't allow `i` to be computed tacitly. If there's no left argument then the modifier `{𝔽⌾(𝕨⊸𝔾)𝕩}` can be more useful, but it doesn't cover some useful cases such as mask `a ⊣⌾(u⊸/) b`. +It's most common to use Under with dyadic structural functions in the form `…⌾(i⊸F)`, for example where `F` is one of `/` or `↑`. This is frustrating for two reasons: it requires parentheses, and it doesn't allow `i` to be computed tacitly. If there's no left argument then the modifier `{𝔽⌾(𝕨⊸𝔾)𝕩}` can be more useful, but it doesn't cover some useful cases such as mask `a ⊣⌾(u⊸/) b`. Another form of Under that's sometimes wanted is `{𝕨⊸𝔽⌾𝔾𝕩}`. One modifier can only do so much. ### List splicing is fiddly It's common when manipulating text to want to replace a slice with a different slice with an unrelated length. Structural Under works well for this if the new slice has the same length but doesn't otherwise (an implementation could choose to support it, but *only* if the slice is extracted using two Drops, not Take). So in general the programmer has to cut off initial and final segments and join them to the new slice. If the new slice is computed from the old one it's much worse, as there will be duplication between the code to extract that slice and the other segments. The duplication can be avoided with Group using `∾F⌾(1⊸⊑)(s‿e⍋↕∘≠)⊸⊔`, but this is a lot of work and will execute slowly without some special support. In fact, everything here is liable to run slowly, making too many copies of the unmodified part of the stream. |
