TODO
-
https://mlochbaum.github.io/BQN/tutorial/expression.html
-
Compound expressions are evaluated from right to left.
-
Motivation
Conor’s Running Product Exercise
But basically you’re given an array of numbers. So for instance we’ll call it 1 2 3 4 and you want to return another array of numbers which is equal to the product of each of them, but where you have removed one element each time.
Solution
×´⊸÷ 1‿2‿3‿4
# ⟨ 24 12 8 6 ⟩
Remove duplicate spaces, turning each sequence of spaces into one
(1⊸»⊸∨' '⊸≠)⊸/d1
Primitives
Glyph | Monadic | Dyadic |
---|---|---|
× |
Sign |
Multiply |
÷ |
Reciprocal |
Divide |
Glyph | Name(s) | Definition | Description |
---|---|---|---|
⊸ |
Before/Bind |
{(𝔽 𝕨 ⊣ 𝕩)𝔾 𝕩} |
𝔾’s left argument comes from 𝔽 |
1-Modifier | Name | 2-Modifier | Name |
---|---|---|---|
´ |
Fold |
Blocks
In BQN, a block is any piece of code surrounded with curly braces {}.
Lowercase | Uppercase | Meaning |
---|---|---|
𝕩 |
𝕏 |
Right argument |
𝕨 |
𝕎 |
Left argument, or Nothing (·) |
𝕤 |
𝕊 |
Function self-reference |
𝕗 |
𝔽 |
Left operand |
𝕘 |
𝔾 |
Right operand |
𝕣 |
none |
Modifier self-reference |