aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2020-07-07 16:17:58 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2020-07-07 16:17:58 -0400
commit91b5abe9fa8b2394606f0eb82bfaeb54fa8a33e8 (patch)
tree26746a3f1c81874c8a65c705d19e6f13355f460c
parent85c54f4c22897972025d76502b9e305541ec5a6e (diff)
Use # instead of ⍝ for comments
-rw-r--r--README.md4
-rwxr-xr-xc.bqn4
-rwxr-xr-xdc.bqn4
-rw-r--r--doc/group.md10
-rw-r--r--doc/join.md6
-rw-r--r--doc/logic.md2
-rw-r--r--doc/transpose.md6
-rw-r--r--spec/grammar.md16
-rw-r--r--spec/reference.bqn148
-rw-r--r--spec/token.md4
10 files changed, 102 insertions, 102 deletions
diff --git a/README.md b/README.md
index dac45d78..b8b4afa0 100644
--- a/README.md
+++ b/README.md
@@ -28,7 +28,7 @@ It's three letters, that happen to match the capitals in "Big Questions Notation
It looks like qebrus okay:
- ⊑+`∘⌽⍟12↕2 ⍝ The 12th Fibonacci number
+ ⊑+`∘⌽⍟12↕2 # The 12th Fibonacci number
[More examples here](https://github.com/mlochbaum/BQN2NGN/tree/master/examples).
@@ -80,7 +80,7 @@ Glyph(s) | Meaning
`𝕩𝕏` | Right argument
`𝕗𝔽` | Left operand (modifier or composition)
`𝕘𝔾` | Right operand (composition)
-`⍝` | Comment
+`#` | Comment
## Built-in operations
diff --git a/c.bqn b/c.bqn
index ef8427de..8125d3f6 100755
--- a/c.bqn
+++ b/c.bqn
@@ -22,13 +22,13 @@ charSet←∾charGroups←⟨
"¯.π∞" ⍝ Numeric
"_"∾' '(⊢∾+)⌾•UCS•a ⍝ Alphabetic
" "∾tab ⍝ Whitespace
-⍝ ⍝'" eliminated during tokenization
+⍝ #'" eliminated during tokenization
bF‿bM‿bC‿bI‿bS‿bG‿bB‿bL‿bD‿bN‿bA‿bW←⊔/≠¨charGroups
vi←+´≠¨8↑charGroups
Tokenize←{
- r←𝕩='⍝'⋄s←/(≠↑2⊸↓)⊸∧𝕩=⊑"'"⋄d←/𝕩='"'
+ r←𝕩='#'⋄s←/(≠↑2⊸↓)⊸∧𝕩=⊑"'"⋄d←/𝕩='"'
g←⍋q←∾⟨ s⋄¯1↓d⋄/r⟩ ⋄q↩g⊏q
e← g⊏∾⟨2+s⋄ 1↓d⋄(⊢-¯1↓0∾⊢)∘⊏⟜(0∾+`r)⊸//(𝕩=lf)∾1⟩
Se←{(⊏˜𝕨)Se 1¨⌾((𝕩/𝕨)⊸⊏)𝕩}⍟{0=⊑⌽𝕩}
diff --git a/dc.bqn b/dc.bqn
index 70f51ff1..ea81ed6b 100755
--- a/dc.bqn
+++ b/dc.bqn
@@ -15,13 +15,13 @@ charSet←∾charGroups←⟨
"_"∾' '(⊢∾+)⌾•UCS•a ⍝ Alphabetic
1↑"𝕨" ⍝ Prefix for input (hack around UTF-16)
" "∾tab ⍝ Whitespace
-⍝ ⍝'" eliminated during tokenization
+⍝ #'" eliminated during tokenization
bF‿bM‿bC‿bI‿bS‿bG‿bB‿bL‿bD‿bN‿bA‿bP‿bW←⊔/≠¨charGroups
vi←+´≠¨8↑charGroups
Tokenize←{
- r←𝕩='⍝'⋄s←/(≠↑2⊸↓)⊸∧𝕩=⊑"'"⋄d←/𝕩='"'
+ r←𝕩='#'⋄s←/(≠↑2⊸↓)⊸∧𝕩=⊑"'"⋄d←/𝕩='"'
g←⍋q←∾⟨ s⋄¯1↓d⋄/r⟩ ⋄q↩g⊏q
e← g⊏∾⟨2+s⋄ 1↓d⋄(⊢-¯1↓0∾⊢)∘⊏⟜(0∾+`r)⊸//(𝕩=nl)∾1⟩
Se←{(⊏˜𝕨)Se 1¨⌾((𝕩/𝕨)⊸⊏)𝕩}⍟{0=⊑⌽𝕩}
diff --git a/doc/group.md b/doc/group.md
index c149716c..b561cd7d 100644
--- a/doc/group.md
+++ b/doc/group.md
@@ -12,12 +12,12 @@ Once defined, the old BQN Key (dyadic) is `⍷⊸⊐⊸⊔` and Group (monadic)
Group operates on a numeric list of indices and a value array, treated as a list of its major cells, to produce a list of groups, each of which is a selection from the values. The indices and values have the same length, and each value cell is paired with the index at the same position. That index indicates the result group the value should go into, with an "index" of ¯1 indicating that it should be dropped and not appear in the result.
- 0‿1‿2‿0‿1 ≍ "abcde" ⍝ Corresponding indices and values
+ 0‿1‿2‿0‿1 ≍ "abcde" # Corresponding indices and values
0 1 2 0 1
a b c d e
- 0‿1‿2‿0‿1 ⊔ "abcde" ⍝ Values grouped by index
+ 0‿1‿2‿0‿1 ⊔ "abcde" # Values grouped by index
[ [ ad ] [ be ] [ c ] ]
For example, we might choose to group a list of words by length. Within each group, values maintain the ordering they had in the list originally.
@@ -168,14 +168,14 @@ In other cases, we might want to split on spaces, so that words are separated by
However, trailing spaces are ignored because Group never produces trailing empty groups (to get them back we would use a dummy final character in the string). To avoid empty words, we should increase the word index only once per group of spaces. We can do this by taking the prefix sum of a list that is 1 only for a space with no space before it. To make such a list, we can use the [Windows](windows.md) function. We will extend our list with an initial 1 so that leading spaces will be ignored. Then we take windows of the same length as the original list: the first includes the dummy argument followed by a shifted copy of the list, and the second is the original list. These represent whether the previous and current characters are spaces; we want positions where the previous wasn't a space and the current is.
- ≍⟜((<´<˘)≠↕1∾⊢) ' '=" string with spaces " ⍝ All, then filtered, spaces
+ ≍⟜((<´<˘)≠↕1∾⊢) ' '=" string with spaces " # All, then filtered, spaces
1 1 0 0 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 0 0 1 1 1
0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0
- ≍⟜(⊢-˜¬×+`∘((<´<˘)≠↕1∾⊢))' '=" string with spaces " ⍝ More processing
+ ≍⟜(⊢-˜¬×+`∘((<´<˘)≠↕1∾⊢))' '=" string with spaces " # More processing
1 1 0 0 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 0 0 1 1 1
¯1 ¯1 0 0 0 0 0 0 ¯1 1 1 1 1 ¯1 ¯1 2 2 2 2 2 2 ¯1 ¯1 ¯1
- ' '((⊢-˜¬×+`∘((<´<˘)≠↕1∾⊢))∘=⊔⊢)" string with spaces " ⍝ Final result
+ ' '((⊢-˜¬×+`∘((<´<˘)≠↕1∾⊢))∘=⊔⊢)" string with spaces " # Final result
[ [ string ] [ with ] [ spaces ] ]
diff --git a/doc/join.md b/doc/join.md
index f11b815a..cb8dfb36 100644
--- a/doc/join.md
+++ b/doc/join.md
@@ -12,9 +12,9 @@ To join with a separator in between, we might prepend the separator to each stri
Join requires each element of its argument to be an array, and their ranks to match exactly. No rank extension is performed.
- ∾"abc"‿'d'‿"ef" ⍝ Includes a non-array
+ ∾"abc"‿'d'‿"ef" # Includes a non-array
RANK ERROR
- ∾"abc"‿(<'d')‿"ef" ⍝ Includes a scalar
+ ∾"abc"‿(<'d')‿"ef" # Includes a scalar
RANK ERROR
However, Join has higher-dimensional uses as well. Given a rank-`m` array of rank-`n` arrays (requiring `m≤n`), it will merge arrays along their first `m` axes. For example, if the argument is a matrix of matrices representing a [block matrix](https://en.wikipedia.org/wiki/Block_matrix), Join will give the corresponding unblocked matrix as its result.
@@ -28,7 +28,7 @@ However, Join has higher-dimensional uses as well. Given a rank-`m` array of ran
┘ ┘ ┘
[ 3 3 3 3 ] [ 4 4 ] [ 5 5 5 5 5 ]
- ∾ m ⍝ Join all that together
+ ∾ m # Join all that together
0 0 0 0 1 1 2 2 2 2 2
0 0 0 0 1 1 2 2 2 2 2
diff --git a/doc/logic.md b/doc/logic.md
index d3bbde18..0e38fb1d 100644
--- a/doc/logic.md
+++ b/doc/logic.md
@@ -10,7 +10,7 @@ Both valences of `¬` are equivalent to the fork `1+-`. The dyadic valence, call
We define:
- Not ← 1+- ⍝ also Span
+ Not ← 1+- # also Span
And ← ×
Or ← ×⌾¬
diff --git a/doc/transpose.md b/doc/transpose.md
index e13b6691..006f0de6 100644
--- a/doc/transpose.md
+++ b/doc/transpose.md
@@ -69,7 +69,7 @@ Certainly not as concise as APL's version, but not a horror either. BQN's rule i
Axis permutations of the types we've shown generate the complete permutation group on any number of axes, so you could produce any transposition you want with the right sequence of monadic transpositions with Rank. However, this can be unintuitive and tedious. What if you want to transpose the first three axes, leaving the rest alone? With monadic Transpose you have to send some axes to the end, then bring them back to the beginning. For example [following four or five failed tries]:
- ≢ ⍉⁼⎉¯2 ⍉ a23456 ⍝ Restrict Transpose to the first three axes
+ ≢ ⍉⁼⎉¯2 ⍉ a23456 # Restrict Transpose to the first three axes
[ 3 4 2 5 6 ]
In a case like this BQN's Dyadic transpose is much easier.
@@ -80,7 +80,7 @@ Transpose also allows a left argument that specifies a permutation of the right
≢ 1‿3‿2‿0‿4 ⍉ a23456
[ 5 2 4 3 6 ]
- ≢ 1‿2‿2‿0‿0 ⍉ a23456 ⍝ Don't worry too much about this case though
+ ≢ 1‿2‿2‿0‿0 ⍉ a23456 # Don't worry too much about this case though
[ 5 2 3 ]
Since this kind of rearrangement can be counterintuitive, it's often easier to use `⍉⁼` when specifying all axes. If `p≡○≠≢a`, then we have `≢p⍉⁼a ←→ p⊏≢a`.
@@ -95,7 +95,7 @@ So far, all like APL. BQN makes one little extension, which is to allow only som
In particular, the case with only one argument specified is interesting. Here, the first axis ends up at the given location. This gives us a much better solution to the problem at the end of the last section.
- ≢ 2 ⍉ a23456 ⍝ Restrict Transpose to the first three axes
+ ≢ 2 ⍉ a23456 # Restrict Transpose to the first three axes
[ 3 4 2 5 6 ]
Finally, it's worth noting that, as monadic Transpose moves the first axis to the end, it's equivalent to dyadic Transpose with a "default" left argument: `(≠∘≢-1˜)⊸⍉`.
diff --git a/spec/grammar.md b/spec/grammar.md
index 2ea60e65..082e8e14 100644
--- a/spec/grammar.md
+++ b/spec/grammar.md
@@ -25,8 +25,8 @@ Starting at the highest-order objects, modifiers and compositions have fairly si
_cmpExp_ = _comp_
| _c_ ASGN _cmpExp_
_modExpr = _mod
- | _comp_ ( value | Func ) ⍝ Right partial application
- | Operand _comp_ ⍝ Left partial application
+ | _comp_ ( value | Func ) # Right partial application
+ | Operand _comp_ # Left partial application
| _m ASGN _modExpr
Functions can be formed by fully applying operators or as trains. Operators are left-associative, so that the left operand (`Operand`) can include operators but the right operand (`value | Func`) cannot. Trains are right-associative, but bind less tightly than operators. Assignment is not allowed in the top level of a train: it must be parenthesized.
@@ -37,10 +37,10 @@ Functions can be formed by fully applying operators or as trains. Operators are
Operand = value
| Derv
Fork = Func
- | Operand Func Fork ⍝ 3-train
- | nothing Func Fork ⍝ 2-train
+ | Operand Func Fork # 3-train
+ | nothing Func Fork # 2-train
Train = Fork
- | Func Fork ⍝ 2-train
+ | Func Fork # 2-train
FuncExpr = Train
| F ASGN FuncExpr
@@ -59,7 +59,7 @@ Value expressions are complicated by the possibility of list assignment. We also
lhs = lhsValue | lhsStr
valExpr = arg
| lhs ASGN valExpr
- | lhs Derv "↩" valExpr ⍝ Modified assignment
+ | lhs Derv "↩" valExpr # Modified assignment
A header looks like a name for the thing being headed, or its application to inputs (possibly twice in the case of modifiers and compositions). As with assignment, it is restricted to a simple form with no extra parentheses. The full list syntax is allowed for arguments. As a special rule, a monadic function header specifically can omit the function when the argument is not just a name (as this would conflict with a value label). The following cases define only headers with arguments, which are assumed to be special cases; there can be any number of these. Headers without arguments can only refer to the general case—note that operands are not pattern matched—so there can be at most two of these kinds of headers, indicating the monadic and dyadic cases.
@@ -70,8 +70,8 @@ A header looks like a name for the thing being headed, or its application to inp
ModH1 = HeadF ( _m | "_𝕣" )
CmpH1 = HeadF ( _c_ | "_𝕣_" ) HeadG
FuncHead = headW? ( F | "𝕊" ) headX
- | vl | "(" valExpr ")" | brVal | list ⍝ value,
- | ANY ( "‿" ANY )+ ⍝ but not v
+ | vl | "(" valExpr ")" | brVal | list # value,
+ | ANY ( "‿" ANY )+ # but not v
_modHead = headW? ModH1 headX
_cmpHed_ = headW? CmpH1 headX
diff --git a/spec/reference.bqn b/spec/reference.bqn
index 241be28a..84f403bf 100644
--- a/spec/reference.bqn
+++ b/spec/reference.bqn
@@ -1,49 +1,49 @@
-⍝ This file gives reference implementations of BQN primitives assuming
-⍝ limited initial functionality. Implementations are designed to be
-⍝ simple and not fast.
-
-⍝ Not yet included: characters, complex numbers, comparison tolerance,
-⍝ selective assignment, and Under.
-
-⍝ In some cases an operation is defined with limited functionality at
-⍝ first and later expanded. For convenience, rather than renaming these
-⍝ limited versions, every primitive use refers to the most recent
-⍝ definition in source code, as if redefinitions shadowed previous
-⍝ primitive definitions.
-
-
-⍝⌜
-⍝ LAYER 0: Assumed functionality
-
-⍝ IEEE 754, except NaN results cause an error and -0 is converted to 0.
-⍝ LIMITED to the stated cases and real number arguments.
-+ ⍝ Add
-- ⍝ Negate Subtract
-× ⍝ Multiply
-÷ ⍝ Reciprocal Divide
-⋆ ⍝ Exponential Power
-⌊ ⍝ Floor
-= ⍝ Equals
-≤ ⍝ Less Than or Equal to
-
-⍝ Other basic functionality that we need to assume
-IsArray ⍝ Return 1 if 𝕩 is an array
-! ⍝ 𝕩 is 0 or 1; throw an error if it's 0
-≢ ⍝ LIMITED to monadic case
-⥊ ⍝ LIMITED to array 𝕩 and (×´𝕨)≡≢𝕩
-⊑ ⍝ LIMITED to natural number 𝕩 and vector 𝕨
-_amend ⍝ {(𝕗⊑𝕩)↩𝕨⋄𝕩}
-↕ ⍝ LIMITED to number 𝕩
-Identity ⍝ Left or right identity of function 𝕏
-⁼ ⍝ Inverse of function 𝔽
-Type ⍝ Scalar (enclosed) prototype of 𝕩
-
-
-⍝⌜
-⍝ LAYER 1: Foundational operators and functions
-
-⍝ Combinators
-◶ ← {𝕨((𝕨𝔽𝕩)⊑𝕘){𝔽}𝕩} ⍝ LIMITED to number left operand result
+# This file gives reference implementations of BQN primitives assuming
+# limited initial functionality. Implementations are designed to be
+# simple and not fast.
+
+# Not yet included: characters, complex numbers, comparison tolerance,
+# selective assignment, and Under.
+
+# In some cases an operation is defined with limited functionality at
+# first and later expanded. For convenience, rather than renaming these
+# limited versions, every primitive use refers to the most recent
+# definition in source code, as if redefinitions shadowed previous
+# primitive definitions.
+
+
+#⌜
+# LAYER 0: Assumed functionality
+
+# IEEE 754, except NaN results cause an error and -0 is converted to 0.
+# LIMITED to the stated cases and real number arguments.
++ # Add
+- # Negate Subtract
+× # Multiply
+÷ # Reciprocal Divide
+⋆ # Exponential Power
+⌊ # Floor
+= # Equals
+≤ # Less Than or Equal to
+
+# Other basic functionality that we need to assume
+IsArray # Return 1 if 𝕩 is an array
+! # 𝕩 is 0 or 1; throw an error if it's 0
+≢ # LIMITED to monadic case
+⥊ # LIMITED to array 𝕩 and (×´𝕨)≡≢𝕩
+⊑ # LIMITED to natural number 𝕩 and vector 𝕨
+_amend # {(𝕗⊑𝕩)↩𝕨⋄𝕩}
+↕ # LIMITED to number 𝕩
+Identity # Left or right identity of function 𝕏
+⁼ # Inverse of function 𝔽
+Type # Scalar (enclosed) prototype of 𝕩
+
+
+#⌜
+# LAYER 1: Foundational operators and functions
+
+# Combinators
+◶ ← {𝕨((𝕨𝔽𝕩)⊑𝕘){𝔽}𝕩} # LIMITED to number left operand result
⊘ ← {𝕨((1{𝔽}𝕨)-0)◶𝔽‿𝔾 𝕩}
⊢ ← {𝕩}
⊣ ← {𝕩}⊘{𝕨}
@@ -53,7 +53,7 @@ Type ⍝ Scalar (enclosed) prototype of 𝕩
⊸ ← {(𝔽𝕨⊣𝕩)𝔾𝕩}
⟜ ← {(𝕨⊣𝕩)𝔽𝔾𝕩}
-⍝ LIMITED to numeric arguments for scalar cases
+# LIMITED to numeric arguments for scalar cases
√ ← 2⊸√ ⊘ (⋆⟜÷˜)
∧ ← ×
∨ ← (+-×)
@@ -66,9 +66,9 @@ Type ⍝ Scalar (enclosed) prototype of 𝕩
× ↩ 0⊸(<->) ⊘ ×
⌊ ↩ ⌊ ⊘ {(𝕨>𝕩)⊑𝕨‿𝕩}
⌈ ← -∘⌊∘- ⊘ {(𝕨<𝕩)⊑𝕨‿𝕩}
-≢ ↩ IsArray◶⟨⟩‿≢ ⍝ LIMITED to monadic case
+≢ ↩ IsArray◶⟨⟩‿≢ # LIMITED to monadic case
-¨ ← _eachm ⍝ LIMITED to monadic case and array 𝕩
+¨ ← _eachm # LIMITED to monadic case and array 𝕩
´ ← _reduce
_eachm←{
@@ -86,14 +86,14 @@ _reduce←{
Length ← (0<0⊑≢)◶⟨1⋄0⊑⊢⟩∘≢
-⍝⌜
-⍝ LAYER 2: Pervasion
-⍝ After defining _perv, we apply it to all scalar functions,
-⍝ making them pervasive. I'm not going to write that out.
+#⌜
+# LAYER 2: Pervasion
+# After defining _perv, we apply it to all scalar functions,
+# making them pervasive. I'm not going to write that out.
ToArray ← IsArray◶<‿⊢
-∾ ← {k←≠𝕨⋄k⊸≤◶⟨⊑⟜𝕨⋄-⟜k⊑𝕩˜⟩¨↕k+≠𝕩} ⍝ LIMITED to two vector arguments
+∾ ← {k←≠𝕨⋄k⊸≤◶⟨⊑⟜𝕨⋄-⟜k⊑𝕩˜⟩¨↕k+≠𝕩} # LIMITED to two vector arguments
_table←{
m←≠a←⥊𝕨 ⋄ n←≠b←⥊𝕩 ⋄ F←𝔽
@@ -103,7 +103,7 @@ _table←{
}
_eachd←{
- _e←{ ⍝ 𝕨 has smaller or equal rank
+ _e←{ # 𝕨 has smaller or equal rank
k←≠p←≢𝕨 ⋄ q←≢𝕩
! ∧´(⊑⟜p=⊑⟜q)¨↕k
l←×´(q⊑˜k⊸+)¨↕q≠⊸-k
@@ -112,7 +112,7 @@ _eachd←{
}
(>○(≠≢))◶⟨𝔽_e⋄𝔽˜_e˜⟩
}
-_perv←{ ⍝ Pervasion
+_perv←{ # Pervasion
(⊢⊘∨○IsArray)◶⟨𝔽⋄𝔽{𝕨𝔽_perv𝕩}¨⟩
}
@@ -120,9 +120,9 @@ _perv←{ ⍝ Pervasion
¨ ↩ {(𝔽_eachm)⊘(𝔽_eachd)○ToArray}
-⍝⌜
-⍝ LAYER 3: Remove other limits
-⍝ Now all implementations are full except ∾; ↕ is monadic only
+#⌜
+# LAYER 3: Remove other limits
+# Now all implementations are full except ∾; ↕ is monadic only
Int←IsArray◶⟨⌊⊸=,0⟩
Nat←IsArray◶⟨0⊸≤∧⌊⊸=,0⟩
@@ -167,14 +167,14 @@ Depth←IsArray◶0‿{1+0⌈´Depth¨⥊𝕩}
⊑ ↩ (0¨∘≢)⊸Pick ⊘ Pick
⥊ ↩ Deshape ⊘ Reshape
↕ ↩ Range
-◶ ↩ {𝕨((𝕨𝔽𝕩)⊑𝕘){𝔽}𝕩} ⍝ Same definition, new Pick
+◶ ↩ {𝕨((𝕨𝔽𝕩)⊑𝕘){𝔽}𝕩} # Same definition, new Pick
≡ ← Depth ⊘ Match
≢ ↩ ≢ ⊘ (¬Match)
-⍝⌜
-⍝ LAYER 4: Operators
+#⌜
+# LAYER 4: Operators
> ↩ Unbox ⊘ >
≍ ← >∘Pair
@@ -232,8 +232,8 @@ _iterate_←{
}
-⍝⌜
-⍝ LAYER 5: Structural functions
+#⌜
+# LAYER 5: Structural functions
⊏ ← 0⊸Select ⊘ Select
↑ ← Prefixes ⊘ Take
@@ -244,10 +244,10 @@ _iterate_←{
_onAxes_←{
F←𝔽
- (𝔾<≡)∘⊣◶{ ⍝ One axis
+ (𝔾<≡)∘⊣◶{ # One axis
! 1≤≠≢𝕩
𝕨F𝕩
- }‿{ ⍝ Multiple axes
+ }‿{ # Multiple axes
! 1≥≠≢𝕨
! 𝕨≤○≠≢𝕩
R←{(⊑𝕨)F(1 DropV 𝕨)⊸R˘𝕩}⍟{0<≠𝕨}
@@ -313,8 +313,8 @@ Rep ← Indices⊸⊏
Replicate ← {0<≠≢𝕨}◶(⥊˜⟜≠Rep⊢)‿{!𝕨=○≠𝕩⋄𝕨Rep𝕩} _onAxes_ (1-0=≠)
-⍝⌜
-⍝ LAYER 6: Everything else
+#⌜
+# LAYER 6: Everything else
∾ ↩ Join ⊘ JoinTo
⊔ ← ⊔⟜(↕≠⚇1) ⊘ Group
@@ -329,7 +329,7 @@ Replicate ← {0<≠≢𝕨}◶(⥊˜⟜≠Rep⊢)‿{!𝕨=○≠𝕩⋄𝕨Rep
⊒ ← OccurrenceCount⊘ ProgressiveIndexOf
Join←{
- C←(<⟨⟩)⥊⊸∾⌜´⊢ ⍝ Cartesian array product
+ C←(<⟨⟩)⥊⊸∾⌜´⊢ # Cartesian array product
! IsArray 𝕩
s←≢¨𝕩
d←≠⊑s
@@ -350,7 +350,7 @@ Group←{
(𝕨⊸=/𝕩˜)¨↕1+¯1⌈´⚇1𝕨
}
-⍝ Searching
+# Searching
IndexOf←{
c←1-˜≠≢𝕨
! 0≤c
@@ -380,10 +380,10 @@ ReorderAxes←{
}
Transpose←(≠∘≢-1˜)⊸ReorderAxes⍟(0<≠∘≢)
-⍝ Sorting
-Cmp ← ∨○IsArray◶{ ⍝ No arrays
- 𝕨(>-<)𝕩 ⍝ Assume they're numbers
-}‿{ ⍝ At least one array
+# Sorting
+Cmp ← ∨○IsArray◶{ # No arrays
+ 𝕨(>-<)𝕩 # Assume they're numbers
+}‿{ # At least one array
e←𝕨-˜○(∨´0=≢)𝕩
𝕨(e=0)◶e‿{
c←𝕨×∘-○(IsArray+≠∘≢)𝕩
diff --git a/spec/token.md b/spec/token.md
index 430869ac..8315c9c2 100644
--- a/spec/token.md
+++ b/spec/token.md
@@ -2,9 +2,9 @@ This page describes BQN's token formation rules (token formation is also called
BQN source code should be considered as a series of unicode code points, which we refer to as "characters". The separator between lines in a file is considered to be a single character, newline, even though some operating systems such as Windows typically represent it with a two-character CRLF sequence. Implementers should note that not all languages treat unicode code points as atomic, as exposing the UTF-8 or UTF-16 representation instead is common. For a language such as JavaScript that uses UTF-16, the double-struck characters `𝕨𝕎𝕩𝕏𝕗𝔽𝕘𝔾` are represented as two 16-bit surrogate characters, but BQN treats them as a single unit.
-A BQN *character literal* consists of a single character between single quotes, such as `'a'`, and a *string literal* consists of any number of characters between double quotes, such as `""` or `"abc"`. Character and string literals take precedence with comments over other tokenization rules, so that `⍝` between quotes does not start a comment and whitespace between quotes is not removed, but a quote within a comment does not start a character literal. Almost any character can be included directly in a character or string literal without escaping. The only exception is the double quote character `"`, which must be written twice to include it in a string, as otherwise it would end the string instead. Character literals require no escaping at all, as the length is fixed. In particular, literals for the double and single quote characters are written `'''` and `'"'`, while length-1 strings containing these characters are `"'"` and `""""`.
+A BQN *character literal* consists of a single character between single quotes, such as `'a'`, and a *string literal* consists of any number of characters between double quotes, such as `""` or `"abc"`. Character and string literals take precedence with comments over other tokenization rules, so that `#` between quotes does not start a comment and whitespace between quotes is not removed, but a quote within a comment does not start a character literal. Almost any character can be included directly in a character or string literal without escaping. The only exception is the double quote character `"`, which must be written twice to include it in a string, as otherwise it would end the string instead. Character literals require no escaping at all, as the length is fixed. In particular, literals for the double and single quote characters are written `'''` and `'"'`, while length-1 strings containing these characters are `"'"` and `""""`.
-A comment consists of the lamp character `⍝` and any following text until (not including) the next newline character. The initial `⍝` must not be part of a string literal started earlier. Comments are ignored entirely and do not form tokens.
+A comment consists of the hash character `#` and any following text until (not including) the next newline character. The initial `#` must not be part of a string literal started earlier. Comments are ignored entirely and do not form tokens.
Identifiers and numeric literals share the same token formation rule. These tokens are formed from the *numeric characters* `¯∞π.0123456789` and *alphabetic characters* `_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` and the oddball `𝕣`. Any sequence of these characters adjacent to each other forms a single token, which is a *numeric literal* if it begins with a numeric character and an *identifier* if it begins with an alphabetic character. Numeric literals are also subject to [numeric literal rules](literal.md), which specify which numeric literals are valid and which numbers they represent. If the token contains `𝕣` it must be either `𝕣`, `_𝕣`, or `_𝕣_` and is considered a special name (see below). As the value taken by this identifier can only be a modifier or composition, the uppercase character `ℝ` is not allowed.