aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/spec/primitive.html3
-rw-r--r--spec/primitive.md4
-rw-r--r--spec/reference.bqn8
3 files changed, 6 insertions, 9 deletions
diff --git a/docs/spec/primitive.html b/docs/spec/primitive.html
index 95b13735..1f9990a2 100644
--- a/docs/spec/primitive.html
+++ b/docs/spec/primitive.html
@@ -79,7 +79,7 @@
<ul>
<li><strong>Choose</strong> (<code><span class='Modifier2'>◶</span></code>) is later redefined to use the complete <code><span class='Function'>⊑</span></code> rather than the simple version assumed (using this primitive means it's not a true combinator).</li>
<li><strong>Constant</strong> (<code><span class='Modifier'>˙</span></code>)</li>
-<li><strong>Valences</strong> (<code><span class='Modifier2'>⊘</span></code>) uses a trick with ambivalent <code><span class='Function'>-</span></code> to find out whether there's a left argument, described below.</li>
+<li><strong>Valences</strong> (<code><span class='Modifier2'>⊘</span></code>)</li>
<li><strong>Right</strong> (<code><span class='Function'>⊢</span></code>)</li>
<li><strong>Left</strong> (<code><span class='Function'>⊣</span></code>)</li>
<li><strong>Self</strong>/<strong>Swap</strong> (<code><span class='Modifier'>˜</span></code>)</li>
@@ -88,7 +88,6 @@
<li><strong>Before</strong>/<strong>Bind</strong> (<code><span class='Modifier2'>⊸</span></code>)</li>
<li><strong>After</strong>/<strong>Bind</strong> (<code><span class='Modifier2'>⟜</span></code>)</li>
</ul>
-<p>The somewhat complicated definition of Valences could be replaced with <code><span class='Brace'>{</span><span class='Function'>𝔽</span><span class='Value'>𝕩</span><span class='Head'>;</span><span class='Value'>𝕨</span><span class='Function'>𝔾</span><span class='Value'>𝕩</span><span class='Brace'>}</span></code> using headers. However, reference.bqn uses a simple subset of BQN's syntax that doesn't include headers. Instead, the definition relies on the fact that <code><span class='Value'>𝕨</span></code> works like <code><span class='Nothing'>·</span></code> if no left argument is given: <code><span class='Paren'>(</span><span class='Number'>1</span><span class='Modifier'>˙</span><span class='Value'>𝕨</span><span class='Paren'>)</span><span class='Function'>-</span><span class='Number'>0</span></code> is <code><span class='Number'>1</span><span class='Function'>-</span><span class='Number'>0</span></code> or <code><span class='Number'>1</span></code> if <code><span class='Value'>𝕨</span></code> is present and <code><span class='Paren'>(</span><span class='Number'>1</span><span class='Modifier'>˙</span><span class='Nothing'>·</span><span class='Paren'>)</span><span class='Function'>-</span><span class='Number'>0</span></code> otherwise: this reduces to <code><span class='Nothing'>·</span><span class='Function'>-</span><span class='Number'>0</span></code> or <code><span class='Number'>0</span></code>.</p>
<h3 id="array-properties"><a class="header" href="#array-properties">Array properties</a></h3>
<p>The reference implementations extend Shape (<code><span class='Function'>≢</span></code>) to atoms as well as arrays, in addition to implementing other properties. In all cases, an atom behaves as if it has shape <code><span class='Bracket'>⟨⟩</span></code>. The functions in this section never cause an error.</p>
<ul>
diff --git a/spec/primitive.md b/spec/primitive.md
index 8f40fa85..ef3055c4 100644
--- a/spec/primitive.md
+++ b/spec/primitive.md
@@ -89,7 +89,7 @@ There's little to say about BQN's true combinators, since each is simply a patte
- **Choose** (`◶`) is later redefined to use the complete `⊑` rather than the simple version assumed (using this primitive means it's not a true combinator).
- **Constant** (`˙`)
-- **Valences** (`⊘`) uses a trick with ambivalent `-` to find out whether there's a left argument, described below.
+- **Valences** (`⊘`)
- **Right** (`⊢`)
- **Left** (`⊣`)
- **Self**/**Swap** (`˜`)
@@ -98,8 +98,6 @@ There's little to say about BQN's true combinators, since each is simply a patte
- **Before**/**Bind** (`⊸`)
- **After**/**Bind** (`⟜`)
-The somewhat complicated definition of Valences could be replaced with `{𝔽𝕩;𝕨𝔾𝕩}` using headers. However, reference.bqn uses a simple subset of BQN's syntax that doesn't include headers. Instead, the definition relies on the fact that `𝕨` works like `·` if no left argument is given: `(1˙𝕨)-0` is `1-0` or `1` if `𝕨` is present and `(1˙·)-0` otherwise: this reduces to `·-0` or `0`.
-
### Array properties
The reference implementations extend Shape (`≢`) to atoms as well as arrays, in addition to implementing other properties. In all cases, an atom behaves as if it has shape `⟨⟩`. The functions in this section never cause an error.
diff --git a/spec/reference.bqn b/spec/reference.bqn
index afd8ccfb..617b88d2 100644
--- a/spec/reference.bqn
+++ b/spec/reference.bqn
@@ -43,9 +43,9 @@ HasFill # Whether 𝕩 has a fill value
# Combinators
◶ ← {𝕨((𝕨𝔽𝕩)⊑𝕘){𝔽}𝕩} # LIMITED to number left operand result
˙ ← {𝕩⋄𝕗}
-⊘ ← {𝕨((1˙𝕨)-0)◶𝔽‿𝔾 𝕩}
+⊘ ← {𝔽𝕩;𝕨𝔾𝕩}
⊢ ← {𝕩}
-⊣ ← {𝕩}⊘{𝕨}
+⊣ ← {𝕩;𝕨}
˜ ← {𝕩𝔽𝕨⊣𝕩}
∘ ← {𝔽𝕨𝔾𝕩}
○ ← {(𝔾𝕨)𝔽𝔾𝕩}
@@ -192,7 +192,7 @@ Depth←IsArray◶0‿{1+0⌈´Depth¨⥊𝕩}
# LAYER 4: Operators
> ↩ Merge⍟IsArray ⊘ >
-⋈ ← {⟨𝕩⟩} ⊘ {⟨𝕨,𝕩⟩}
+⋈ ← {⟨𝕩⟩;⟨𝕨,𝕩⟩}
≍ ← >∘⋈
⎉ ← _rankOp_
⚇ ← _depthOp_
@@ -218,7 +218,7 @@ ValidateRanks←{
}
_ranks ← {⟨2⟩⊘⟨1,0⟩ ((⊣-1+|)˜⟜≠⊑¨<∘⊢) ValidateRanks∘𝔽}
_depthOp_←{
- neg←0>n←𝕨𝔾_ranks𝕩 ⋄ F←𝔽 ⋄ B←{𝕏}⊘{𝕨˙⊸𝕏}
+ neg←0>n←𝕨𝔾_ranks𝕩 ⋄ F←𝔽 ⋄ B←{𝕏;𝕨˙⊸𝕏}
_d←{
R←(𝕗+neg)_d
𝕨(2⥊(neg∧𝕗≥0)∨(0⌈𝕗)≥⋈○≡)◶(⟨R¨⋄R⟜(𝕩˙)¨∘⊣⟩≍⟨(𝕨 B r)¨∘⊢⋄F⟩)𝕩