aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2022-06-01 17:20:29 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2022-06-01 17:20:29 -0400
commit16ea00650607ba5affc3b94fe133e69920954aa5 (patch)
tree07611e8cbce1cfeff91c6c42ff940c6080019b5f /spec
parentd34927a5589b67c0a73bee42904fffe647b6c534 (diff)
Use ; for block valences in reference.bqn where reasonable
Diffstat (limited to 'spec')
-rw-r--r--spec/primitive.md4
-rw-r--r--spec/reference.bqn8
2 files changed, 5 insertions, 7 deletions
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⟩)𝕩