diff options
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 + + |
