Post History
BQN, 19 bytesSBCS ' '+32⊸<⊸×+⌜˜⌽⊸⌊↕59 Run online! This uses the whitespace allowance, padding by four spaces on all sides to make the arithmetic work better. It can be adjusted by replacing...
Answer
#1: Initial revision
# [BQN](https://mlochbaum.github.io/BQN/), 19 bytes<sup>[SBCS](https://github.com/mlochbaum/BQN/blob/master/commentary/sbcs.bqn)</sup> ``` ' '+32⊸<⊸×+⌜˜⌽⊸⌊↕59 ``` [Run online!](https://mlochbaum.github.io/BQN/try.html#code=JyAnKzMy4oq4POKKuMOXK+KMnMuc4oy94oq44oyK4oaVNTk=) This uses the whitespace allowance, padding by four spaces on all sides to make the arithmetic work better. It can be adjusted by replacing `↕59` with `4+↕51` at the cost of two characters. BQN has no built-in idea of the alphabet, but it has a nice system for Unicode [character arithmetic](https://mlochbaum.github.io/BQN/tutorial/expression.html#character-arithmetic). This solution depends on the length 26 of the alphabet, and the distance 33 (`'A'-' '`) from space to the start. Fortunately these are close together. We will build a matrix of numbers that goes from 0, for `' '`, at the corners to `33+26-1`, or 58, at the center, then bring all numbers below 33 to 0. At the middle of each edge we get 29, leaving 4 spaces before `'A'`. [Before](https://mlochbaum.github.io/BQN/tutorial/combinator.html#before-and-after) plays a big role here. ``` ' '+32⊸<⊸×+⌜˜⌽⊸⌊↕59 ↕59 # Range 0...58 ⌽ # Reverse: 58...0 ⊸⌊ # Before Minimum: 0…29…0 +⌜ # Addition table ˜ # with itself 32⊸< # More than 32 ⊸× # times the original ' '+ # Add to space ``` Another 21-character "exact" solution is `(+⌜˜⊏-∘≠↑'A'+⍷)⌽⊸⌊↕51`. Now `'A'` is used as the basis and spaces come from fill elements in Take (`↑`), so it will work for any starting character.