about summary refs log tree commit diff stats
path: root/bqn/ref.txt
blob: dca4969bb6aebd43bd346c74aeceacad9dfc7fd9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
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