diff options
author | elioat <elioat@tilde.institute> | 2022-10-21 09:55:13 -0400 |
---|---|---|
committer | elioat <elioat@tilde.institute> | 2022-10-21 09:55:13 -0400 |
commit | afe826655ae81664afdfcbf76eea1933b0e5757a (patch) | |
tree | ee7d1f164c4ccd2df31c62b5cad29cb29499f0d8 /bqn | |
parent | d794d27e54a51ce70ab8304dbfa2431bfec6838b (diff) | |
download | tour-afe826655ae81664afdfcbf76eea1933b0e5757a.tar.gz |
*
Diffstat (limited to 'bqn')
-rw-r--r-- | bqn/ref.txt | 153 |
1 files changed, 153 insertions, 0 deletions
diff --git a/bqn/ref.txt b/bqn/ref.txt new file mode 100644 index 0000000..dca4969 --- /dev/null +++ b/bqn/ref.txt @@ -0,0 +1,153 @@ +| syntax | name | usage +| { | begin block | {𝕩+2} +| } | end block | +| ( | begin expression | (1+2)×(10÷2) +| ) | end expression | +| ‿ | ligature | 1‿2‿3‿4 +| ⟨ | begin list | ⟨1 ⋄ 2 ⋄ 3 ⋄ 4⟩ +| ⟩ | end list | +| # | comment | # this is a comment +| ← | define | myVar←5 ⋄ MyFn←{𝕨+𝕩} +| ⋄ | separator | {a←1+𝕩 ⋄ a×a} 10 +| , | separator | ⟨"foo", "bar"⟩ # equal to ⋄ and newline +| ⇐ | export | {F⇐{1+𝕩}}.F 10 +| ↩ | change | var ← 5 ⋄ var ↩ 7 ⋄ var +↩ 1 +| • | system | •Out "Hello World" ⋄ •Show ↕2‿2 +| . | namespace field | •file.Lines "myfile.txt" +| → | return | [NYI/TBD] +| ¯N | negative number | ¯3‿¯2‿¯1 = -3‿2‿1 + + + +| fns | name | usage +| + 𝕩 | conjugate | +| 𝕨 + 𝕩 | add | 1‿2‿3 + 1‿2‿3 +| - 𝕩 | negate | - 1‿2‿3 +| 𝕨 - 𝕩 | subtract | 2 - 1‿2‿3 +| × 𝕩 | sign | × ¯2‿¯1‿0‿1‿2 +| 𝕨 × 𝕩 | multiply | 2 × 1‿2‿3 +| ÷ 𝕩 | reciprocal | ÷ 2 +| 𝕨 ÷ 𝕩 | divide | 100 ÷ 2‿5‿50 +| ⋆ 𝕩 | exponential | ⋆ 5 +| 𝕨 ⋆ 𝕩 | power | 10 ⋆ 2 +| √ 𝕩 | square root | √ 100 +| 𝕨 √ 𝕩 | nth root | 3 √ 125 +| ⌊ 𝕩 | floor | ⌊ 1.5 +| 𝕨 ⌊ 𝕩 | minimum | 10 ⌊ 5 +| ⌈ 𝕩 | ceiling | ⌈ 1.5 +| 𝕨 ⌈ 𝕩 | maximum | 10 ⌈ 5 +| ∧ 𝕩 | sort up | ∧ 5‿2‿3 +| 𝕨 ∧ 𝕩 | and | 0‿0‿1‿1 ∧ 0‿1‿0‿1 +| ∨ 𝕩 | sort down | ∨ 3‿2‿5 +| 𝕨 ∨ 𝕩 | or | 0‿0‿1‿1 ∨ 0‿1‿0‿1 +| ¬ 𝕩 | not | ¬ 1‿0‿1 +| 𝕨 ¬ 𝕩 | span | 20 ¬ 15 +| \| 𝕩 | absolute value | \| ¯5‿3‿¯2 +| 𝕨 \| 𝕩 | modulus | 5 \| 3‿4‿5‿6‿7 +| 𝕨 ≤ 𝕩 | lt or equal to | 3 ≤ 4 +| < 𝕩 | enclose | <1 +| 𝕨 < 𝕩 | less than | 1 < 2 +| > 𝕩 | merge | > ⟨1‿2 ⋄ 3‿4 ⋄ 5‿6⟩ +| 𝕨 > 𝕩 | greater than | 1 > 2 +| 𝕨 ≥ 𝕩 | gt or equal to | 4 ≥ 3 +| = 𝕩 | rank | = 2‿2‿2⥊1 +| 𝕨 = 𝕩 | equals | 1‿2‿3 = 1‿2‿4 +| ≠ 𝕩 | length | ≠ 2‿3‿5 +| 𝕨 ≠ 𝕩 | not equals | 1‿2‿3 ≠ 1‿2‿4 +| ≡ 𝕩 | depth | ≡¨ 1‿⟨1⟩‿⟨⟨1⟩⟩ +| 𝕨 ≡ 𝕩 | match | 1‿2‿3 ≡ 1‿2‿3 +| ≢ 𝕩 | shape | ≢ 4‿4⥊1 +| 𝕨 ≢ 𝕩 | not match | 1‿2‿3 ≢ 1‿2‿4 +| ⊣ 𝕩 | identity | ⊣ 4 +| 𝕨 ⊣ 𝕩 | left | 3 ⊣ 5 +| ⊢ 𝕩 | identity | ⊢ 5 +| 𝕨 ⊢ 𝕩 | right | 3 ⊢ 4 +| ⥊ 𝕩 | deshape | ⥊ >⟨1‿2 ⋄ 3‿4⟩ +| 𝕨 ⥊ 𝕩 | reshape | 3‿3 ⥊ ↕9 +| ∾ 𝕩 | join | ∾ ⟨1‿2 ⋄ 3‿4 ⋄ 5‿6⟩ +| 𝕨 ∾ 𝕩 | join to | 1‿2‿3 ∾ 4‿5‿6 ∾ 7 +| ≍ 𝕩 | solo | ≍¨ ⟨1 ⋄ 1‿2‿3⟩ +| 𝕨 ≍ 𝕩 | couple | 1‿2‿3 ≍ 4‿5‿6 +| ↑ 𝕩 | prefixes | ↑ 1‿2‿3 +| 𝕨 ↑ 𝕩 | take | 2 ↑ 2‿3‿5 +| ↓ 𝕩 | sufixes | ↓ 1‿2‿3 +| 𝕨 ↓ 𝕩 | drop | 2 ↓ 2‿3‿5 +| ↕ 𝕩 | range | ↕ 4 +| 𝕨 ↕ 𝕩 | windows | 3 ↕ 1‿2‿3‿4‿5‿6 +| « 𝕩 | nudge | « 5‿6‿7‿8‿9 +| 𝕨 « 𝕩 | shift before | 99 « 5‿6‿7‿8‿9 +| » 𝕩 | nudge after | » 5‿6‿7‿8‿9 +| 𝕨 » 𝕩 | shift after | 99 » 5‿6‿7‿8‿9 +| ⌽ 𝕩 | reverse | ⌽ 1‿2‿3 +| 𝕨 ⌽ 𝕩 | rotate | 2 ⌽ 1‿2‿3‿4‿5‿6 +| ⍉ 𝕩 | transpose | ⍉ 3‿4⥊↕12 +| 𝕨 ⍉ 𝕩 | reorder axes | \a | 0‿0 ⍉ 3‿3⥊↕9 +| / 𝕩 | indices | / 1‿0‿0‿1‿1‿4 +| 𝕨 / 𝕩 | replicate | 1‿0‿4 / 1‿2‿3 +| ⊏ 𝕩 | first cell | ⊏ 3‿3‿3⥊↕27 +| 𝕨 ⊏ 𝕩 | select | 1‿1‿0‿2 ⊏ 3‿3⥊↕9 +| ⊑ 𝕩 | first | ⊑ 3‿3⥊↕9 +| 𝕨 ⊑ 𝕩 | pick | 2 ⊑ "abcde" ⋄ 1‿1 ⊑ 3‿3⥊↕ +| ⊐ 𝕩 | classify | ⊐ 4‿5‿6‿4‿5‿8‿9‿4‿5 +| 𝕨 ⊐ 𝕩 | index of | "abcde" ⊐ "bar" +| ⊒ 𝕩 | occurence cnt | ⊒ 4‿5‿6‿4‿5‿8‿9‿4‿5 +| 𝕨 ⊒ 𝕩 | progressive ix | 2‿2‿1‿2‿2 ⊒ 2‿2‿2‿2‿1‿1‿2 +| ⍋ 𝕩 | grade up | (⍋3‿5‿2)⊏3‿5‿2 +| 𝕨 ⍋ 𝕩 | bins up | 10‿20‿30 ⍋ 18‿19‿20‿21‿22 +| ⍒ 𝕩 | grade down | (⍒3‿5‿2)⊏3‿5‿2 +| 𝕨 ⍒ 𝕩 | bins down | 30‿20‿10 ⍒ 18‿19‿20‿21‿22 +| ∊ 𝕩 | mark first | ∊ "mississippi" +| 𝕨 ∊ 𝕩 | member of | 3‿7 ∊ 1‿2‿3‿4 +| ⍷ 𝕩 | deduplicate | ⍷ "mississippi" +| 𝕨 ⍷ 𝕩 | find | "is" ⍷ "mississippi" +| ⊔ 𝕩 | group indices | ⊔1‿2‿3‿1‿2‿5‿1‿1‿3 +| 𝕨 ⊔ 𝕩 | group | 0‿0‿¯1‿1‿1‿1 ⊔ "ab cde" +| ! 𝕩 | assert | ! 1>2 +| 𝕨 ! 𝕩 | assert with msg| "this is false" ! 1>2 + + + +| mds | name | usage +| ˙ | constant | (⊢ ÷ 2˙) 10 +| ˜ | self/swap | ט 4 +| ∘ | atop | 10 -∘÷ 2 +| ○ | over | "abc" +○≠ "abcde" +| ⊸ | before/bind | {𝕩>4}⊸/ ↕10 +| ⟜ | after/bind | ÷⟜2 10 +| ⌾ | under | {1+𝕩}⌾(1‿0‿1⊸/) 10‿20‿30 +| ⎉ | rank | <⎉2 3‿3‿3⥊↕27 +| ˘ | cells | ⌽˘ 3‿3⥊↕9 +| ⚇ | depth | {+´↕𝕩}⚇0 ⟨1‿2‿3 ⋄ 4⟩ +| ¨ | each | ×´¨ ⟨1‿2⟩‿⟨3‿4⟩ +| ⍟ | repeat | ({𝕩+2}⍟3) 0 +| ⁼ | undo | /⁼ 1‿2‿4‿9 +| ◶ | choose | {𝕩>0}◶-‿⊢¨ ¯6‿7 ⋄ (7>2)◶0‿{𝕩‿𝕩} 5 +| ⌜ | table | (↕4) ×⌜ ↕8 +| ⊘ | valences | F←{-𝕩}⊘{𝕨÷𝕩} ⋄ F 2 ⋄ 8 F 2 +| ´ | fold | +´1‿2‿3‿4 +| ⎊ | catch | {4⊑𝕩}⎊"error" 1‿2 +| ˝ | insert | +˝ 3‿3⥊↕9 +| ` | scan | +\`1‿2‿3‿40 + + + +| arguments | name | usage +| 𝕩 | right argument | {1+𝕩} 5 +| 𝕨 | left argument | 20 {𝕨-𝕩} 5 +| 𝕏 | right argument (function) | F←- ⋄ 4 {𝕏𝕨} f +| 𝕎 | left argument (function) | F←- ⋄ f {𝕎𝕩} 5 +| 𝕗 | modifier left operand (subject) | -{𝕗‿𝕩} 5 +| 𝕘 | modifier right operand (subject)| -{𝔽 𝕘⊑𝕩}1 5‿6‿7‿8 +| 𝔽 | modifier left operand | -{𝔽 𝕩} 5 +| 𝔾 | modifier right operand | -{𝔽 𝔾 𝕩}÷ 10 +| 𝕤 | current function (subject) | {𝕤 ⋄ 2+2} +| 𝕊 | current function | {𝕩 × (𝕩>1)◶1‿𝕊 𝕩-1}5 +| 𝕣 | current modifier | ×{𝕩 𝔽 (𝕩>1)◶1‿(𝕗 _𝕣) 𝕩-1} + + + +| constants | name | usage +| π | pi | 2 × π +| ∞ | infinity | ¯∞ ≡ ¯5÷0 +| @ | null character | "foo"-@ +| · | nothing | (÷ ·- ⊑) 5‿6‿7 |