diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2022-01-19 15:10:38 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-19 15:10:38 -0500 |
| commit | ce364aeae795ca8a8e46e653b8024ac5a9ad0982 (patch) | |
| tree | 7af238dbdb370a768f965066dadadd144cbd70f7 /help/deshape_reshape.md | |
| parent | 8f0aa14fa695ff3aa3b3ed96c02fdb2ab99f272c (diff) | |
| parent | edddb9be0aa1f03c8608d3dabf7ccfea3fdde206 (diff) | |
Merge pull request #55 from razetime/master
Simple help pages for Primitive Symbols
Diffstat (limited to 'help/deshape_reshape.md')
| -rw-r--r-- | help/deshape_reshape.md | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/help/deshape_reshape.md b/help/deshape_reshape.md new file mode 100644 index 00000000..98e930b3 --- /dev/null +++ b/help/deshape_reshape.md @@ -0,0 +1,31 @@ +*View this file with results and syntax highlighting [here](https://mlochbaum.github.io/BQN/help/deshape_reshape.html).* + +# Barb (`⥊`) + +## `⥊ 𝕩`: Deshape + +Put all elements of `𝕩` in a rank 1 array, converting to array if necessary. + + ⥊ 1 + + ⥊ 1‿2 ≍ 3‿4 + + + +## `𝕨 ⥊ 𝕩`: Reshape + +Put all elements of `𝕩` in an array of shape `𝕨`, adding or removing elements if necessary. + +A single element in `𝕩` can be a function, which will be replaced with an appropriate length: +- `∘` Exact fit +- `⌊` Round length down, discarding elements +- `⌽` Round length up +- `↑` Round length up, and use element fill to add extra elements. + + 3‿3 ⥊ 3 + + 2‿⌽‿2 ⥊ 1‿2‿3 + + 2‿↑‿2 ⥊ 1‿2‿3 + + |
