File: prism-bqn.html

package info (click to toggle)
node-prismjs 1.30.0%2Bdfsg%2B~1.26.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 19,220 kB
  • sloc: javascript: 27,628; makefile: 9; sh: 7; awk: 4
file content (125 lines) | stat: -rw-r--r-- 2,625 bytes parent folder | download | duplicates (2)
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
<h2>Examples From Rosetta Code</h2>
<h3>100 Doors</h3>
<pre><code>
swch ← ≠´{100⥊1«𝕩⥊0}¨1+↕100
¯1↓∾{𝕩∾@+10}¨•Fmt¨⟨swch,/swch⟩
</code></pre>
<h3>Archimedean Spiral</h3>
<pre><code>
{(•math.Sin •Plot○(⊢×↕∘≠) •math.Cos) -(2×π) × 𝕩⥊(↕÷-⟜1)100}
</code></pre>
<h3>Damm Algorithm</h3>
<pre><code>
table ← >⟨ 0‿3‿1‿7‿5‿9‿8‿6‿4‿2
	   7‿0‿9‿2‿1‿5‿4‿8‿6‿3
	   4‿2‿0‿6‿8‿7‿1‿3‿5‿9
	   1‿7‿5‿0‿9‿8‿3‿4‿2‿6
	   6‿1‿2‿3‿0‿4‿5‿9‿7‿8
	   3‿6‿7‿4‿2‿0‿9‿5‿8‿1
	   5‿8‿6‿9‿7‿2‿0‿1‿3‿4
	   8‿9‿4‿5‿3‿6‿2‿0‿1‿7
	   9‿4‿3‿8‿6‿1‿7‿2‿0‿5
	   2‿5‿8‿1‿4‿3‿6‿7‿9‿0 ⟩


Digits ← 10{⌽𝕗|⌊∘÷⟜𝕗⍟(↕1+·⌊𝕗⋆⁼1⌈⊢)}

Damm ← {0=0(table⊑˜⋈)˜´⌽Digits 𝕩}

Damm¨5724‿5727‿112946
</code></pre>
<h3>Knuth/Fisher-Yates Shuffle</h3>
<pre><code>
Knuth ← {
  𝕊 arr:
  l ← ≠arr
  {
    arr ↩ ⌽⌾(⟨•rand.Range l, 𝕩⟩⊸⊏)arr
  }¨↕l
  arr
}
P ← •Show Knuth

P ⟨⟩
P ⟨10⟩
P ⟨10, 20⟩
P ⟨10, 20, 30⟩
</code></pre>
<h2>Comments</h2>
<pre><code>#!/usr/bin/env bqn
# Full Line Comment
'#'  # The preceding should not be a comment.
"BQN is #1" # The preceding should not be a comment.
1 + 1 # Comment at End of Line.
</code></pre>

<h2>Literals</h2>
<pre><code>
"String Literal"
'c'
"""There is a double quote at the start of this string."
"'c'"
# "Comment, not String"
"String, # Not Comment"
@
</code></pre>

<h2>Tokens</h2>
<h3>Primitive Functions</h3>
<pre><code>
+-×÷⋆√⌊⌈|¬∧∨&lt;&gt;≠=≤≥≡≢⊣⊢⥊∾≍⋈↑↓↕«»⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔!
</code></pre>
<h3>1-Operators</h3>
<pre><code>
˙˜˘¨⌜⁼´˝`
</code></pre>
<h3>2-Operators</h3>
<pre><code>
∘○⊸⟜⌾⊘◶⎉⚇⍟⎊
</code></pre>
<h3>Special Names</h3>
<pre><code>
𝕨𝕩𝕗𝕘𝕤𝕎𝕏𝔽𝔾𝕊𝕣_𝕣
_𝕣_
</code></pre>
<h3>Punctuation</h3>
<pre><code>
←⇐↩(){}⟨⟩[]‿·⋄,.;:?
</code></pre>

<h2>Words</h2>
<h3>Numbers</h3>
<pre><code>
1464
3.14159
¯2
π
¯∞
2.8e¯4
1.618E2
</code></pre>
<h3>Names</h3>
<pre><code>
VariableName
ThereAre4Symbols_¯∞πAllowedInNames
</code></pre>
<h2>Namespaces</h2>
<pre><code>
example.b
{n⇐7}.n
</code></pre>
<h2>System Functions</h2>
<pre><code>
•Function
 •function
•_function_
@•Function@
+•Function+
˙•Function˙
∘•Function∘
𝕨•Function𝕩
←•Function?
•Function_.¯∞πCanHaveSymbols
•0.0.0.0
</code></pre>