From 2c50d91ec7eb8bc7890befe874a0b93729c2437e Mon Sep 17 00:00:00 2001 From: razetime Date: Wed, 19 Jan 2022 22:48:16 +0530 Subject: add h2s remove copied output, ascii filenames --- help/deshape_reshape.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 help/deshape_reshape.md (limited to 'help/deshape_reshape.md') 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 + + -- cgit v1.2.3