aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2021-10-25 21:34:35 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2021-10-25 21:34:35 -0400
commit66272177ff5d3cf64ef2371d9a16612c4019a9b2 (patch)
tree3be749586e05117d135e809e16b8e5728d4f8b4b /spec
parentba9e770a76f1857014cae81ea3a4eadb27eb250c (diff)
Add ⋈ (Enlist/Pair) to specification
Diffstat (limited to 'spec')
-rw-r--r--spec/inferred.md4
-rw-r--r--spec/primitive.md2
-rw-r--r--spec/reference.bqn12
-rw-r--r--spec/token.md2
4 files changed, 10 insertions, 10 deletions
diff --git a/spec/inferred.md b/spec/inferred.md
index 5cf1021d..73fc4abd 100644
--- a/spec/inferred.md
+++ b/spec/inferred.md
@@ -44,13 +44,13 @@ Combinators `⊣⊢!˙˜´˝∘○⊸⟜⊘◶⍟` do not affect fill element co
Arithmetic primitives—all valences of `+-×÷⋆√⌊⌈|¬` and dyadic `∧∨<>≠=≤≥`—obtain their fill elements by applying to the fill elements of the arguments. If this is an error, there is no fill element; otherwise, the fill element is the result, with all numbers in it changed to `0` and all characters changed to `' '`.
-Fill elements for many primitives are given in the table below. The "Fill" column indicates the strategy used to compute the result's fill. Fields `0`, `𝕩`, `0↑𝕩`, and `0⚇0𝕩` indicate the fill directly, while `⊢` and `∩` indicate that the fill is to be computed from the argument fills (if not all arguments have fills, then the fill element is unspecified). For `⊢`, the fill element of the result is the fill element of `𝕩`. For `∩`, the fill is equal to the fill values for multiple arrays, provided that they are all equal (it's unspecified if they are not all equal). In the two argument case, these arrays are `𝕨` and `𝕩`. In the one-argument case, they are the elements of `𝕩`; however, if `𝕩` is empty, then the result's fill is the fill of the fill of `𝕩`.
+Fill elements for many primitives are given in the table below. The "Fill" column indicates the strategy used to compute the result's fill. Fields `0`, `𝕩`, and `0↑𝕩` indicate the fill directly, except that for dyadic `⋈` the fill is specified only if it's the same as that obtained from `𝕨`. `⊢` and `∩` indicate that the fill is to be computed from the argument fills (if not all arguments have fills, then the fill element is unspecified). For `⊢`, the fill element of the result is the fill element of `𝕩`. For `∩`, the fill is equal to the fill values for multiple arrays, provided that they are all equal (it's unspecified if they are not all equal). In the two argument case, these arrays are `𝕨` and `𝕩`. In the one-argument case, they are the elements of `𝕩`; however, if `𝕩` is empty, then the result's fill is the fill of the fill of `𝕩`.
| Fill | Monads | Dyads | Modifiers
|--------|--------------|-------------|----------
| `⊢` | `∧∨⥊≍»«⌽⍉⊏⍷` | `⥊↑↓↕⌽⍉/⊏` | `` 𝔽` ``
| `0` | `≢/⍋⍒∊⊐⊒` | `⍋⍒⊐⊒∊⍷`
-| `𝕩` | `<↕`
+| `𝕩` | `<↕⋈` | `⋈`
| `∩` | `>∾` | `∾≍»«`
| `0↑𝕩` | `↑↓`
diff --git a/spec/primitive.md b/spec/primitive.md
index 37132ead..9b4b1e2b 100644
--- a/spec/primitive.md
+++ b/spec/primitive.md
@@ -141,7 +141,7 @@ A left argument for any of the three reduction-based modifiers indicates an init
### Restructuring
-**Enclose** (`<`) forms a unit array that contains its argument.
+**Enclose** (`<`) forms a unit array that contains its argument. **Enlist** and **Pair** (`⋈`) form a 1- or 2-element list of all arguments, that is, `⟨𝕩⟩` or `⟨𝕨,𝕩⟩`.
**Merge** (`>`) combines the outer axes of an array of arrays with inner axes: it requires that all elements of its argument have the same shape, and creates an array such that `(i∾j)⊑>𝕩` is `i⊑j⊑𝕩`. It also accepts atom elements of `𝕩`, converting them to unit arrays, or an atom argument, which is returned unchanged. **Solo** and **Couple** (`≍`) turn one or two arguments into major cells of the result and can be defined easily in terms of Merge.
diff --git a/spec/reference.bqn b/spec/reference.bqn
index f37e184e..eadac7ae 100644
--- a/spec/reference.bqn
+++ b/spec/reference.bqn
@@ -199,7 +199,8 @@ Depth←IsArray◶0‿{1+0⌈´Depth¨⥊𝕩}
# LAYER 4: Operators
> ↩ Merge⍟IsArray ⊘ >
-≍ ← >∘Pair
+⋈ ← {⟨𝕩⟩} ⊘ {⟨𝕨,𝕩⟩}
+≍ ← >∘⋈
⎉ ← _rankOp_
⚇ ← _depthOp_
⍟ ↩ _repeat_
@@ -209,7 +210,6 @@ Depth←IsArray◶0‿{1+0⌈´Depth¨⥊𝕩}
DropV← {⊑⟜𝕩¨𝕨+↕𝕨-˜≠𝕩}
Cell ← DropV⟜≢
-Pair ← {⟨𝕩⟩} ⊘ {⟨𝕨,𝕩⟩}
Merge←(0<≠∘⥊)◶((∾○≢⥊⊢)⟜Fill)‿{
c←≢⊑𝕩
@@ -228,12 +228,12 @@ _depthOp_←{
neg←0>n←𝕨𝔾_ranks𝕩 ⋄ F←𝔽 ⋄ B←{𝕏}⊘{𝕨˙⊸𝕏}
_d←{
R←(𝕗+neg)_d
- 𝕨(2⥊(neg∧𝕗≥0)∨(0⌈𝕗)≥Pair○≡)◶(⟨R¨⋄R⟜(𝕩˙)¨∘⊣⟩≍⟨(𝕨 B r)¨∘⊢⋄F⟩)𝕩
+ 𝕨(2⥊(neg∧𝕗≥0)∨(0⌈𝕗)≥⋈○≡)◶(⟨R¨⋄R⟜(𝕩˙)¨∘⊣⟩≍⟨(𝕨 B r)¨∘⊢⋄F⟩)𝕩
}
𝕨 n _d 𝕩
}
_rankOp_←{
- k←𝕨(Pair○= (0≤⊢)◶⟨⌊⟜-,0⌈-⟩¨ 𝔾_ranks)𝕩
+ k←𝕨(⋈○= (0≤⊢)◶⟨⌊⟜-,0⌈-⟩¨ 𝔾_ranks)𝕩
Enc←{
f←⊑⟜(≢𝕩)¨↕𝕨
c←×´s←𝕨Cell𝕩
@@ -309,7 +309,7 @@ SelSub←{
Select←ToArray⊸(SelSub _onAxes_ 1)
JoinTo←{
- s←𝕨Pair○≢𝕩
+ s←𝕨⋈○≢𝕩
a←1⌈´k←≠¨s
! ∧´1≥a-k
c←(k¬a)+⟜(↕a-1)⊸⊏¨s
@@ -392,7 +392,7 @@ Join←(0<=)◶{!IsArray𝕩⋄>𝕩}‿{
Group←{
! IsArray 𝕩
- 𝕨↩Pair∘ToArray⍟(2>≡)𝕨
+ 𝕨↩⋈∘ToArray⍟(2>≡)𝕨
! 1==𝕨
{!∧´Int¨𝕩⋄!∧´¯1≤𝕩}∘⥊¨𝕨
n←+´r←=¨𝕨
diff --git a/spec/token.md b/spec/token.md
index 230f1f0b..522179c8 100644
--- a/spec/token.md
+++ b/spec/token.md
@@ -21,7 +21,7 @@ Otherwise, a single character forms a token. Only the specified set of character
| Class | Characters
|-----------------------|------------
| Null literal | `@`
-| Primitive Function | `+-×÷⋆√⌊⌈\|¬∧∨<>≠=≤≥≡≢⊣⊢⥊∾≍↑↓↕«»⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔!`
+| Primitive Function | `+-×÷⋆√⌊⌈\|¬∧∨<>≠=≤≥≡≢⊣⊢⥊∾≍⋈↑↓↕«»⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔!`
| Primitive 1-Modifier | `` ˙˜˘¨⌜⁼´˝` ``
| Primitive 2-Modifier | `∘○⊸⟜⌾⊘◶⎉⚇⍟⎊`
| Special name | `𝕨𝕩𝕗𝕘𝕤𝕎𝕏𝔽𝔾𝕊`