From b3ecbb5695a5a0a0637c924da0022abca940ffee Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Tue, 21 Jul 2020 19:13:22 -0400 Subject: Add Rank function as monadic = --- README.md | 2 +- doc/depth.md | 2 +- doc/transpose.md | 8 +++--- docs/doc/depth.html | 2 +- docs/doc/transpose.html | 8 +++--- docs/index.html | 2 +- dzref | 37 ++++++++++++++------------- md.bqn | 10 ++++---- spec/reference.bqn | 68 ++++++++++++++++++++++++------------------------- test/testref.bqn | 2 +- 10 files changed, 71 insertions(+), 70 deletions(-) diff --git a/README.md b/README.md index 4f24a48a..84e8c0a1 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,7 @@ Functions that have significant differences from APL functions are marked with a | `<` | [Enclose](https://aplwiki.com/wiki/Enclose) | [Less Than](https://aplwiki.com/wiki/Less_than) | `>` | [Merge](https://aplwiki.com/wiki/Mix) | [Greater Than](https://aplwiki.com/wiki/Greater_than) | `≥` | | [Greater Than or Equal to](https://aplwiki.com/wiki/Greater_than_or_Equal_to) -| `=` | | [Equals](https://aplwiki.com/wiki/Equal_to) +| `=` | Rank | [Equals](https://aplwiki.com/wiki/Equal_to) | `≠` | [Length](https://aplwiki.com/wiki/Tally) | [Not Equals](https://aplwiki.com/wiki/Not_Equal_to) | `≡` | [Depth](doc/depth.md)* | [Match](https://aplwiki.com/wiki/Match) | `≢` | [Shape](https://aplwiki.com/wiki/Shape) | [Not Match](https://aplwiki.com/wiki/Not_Match) diff --git a/doc/depth.md b/doc/depth.md index 8738e7ed..d1e4fda3 100644 --- a/doc/depth.md +++ b/doc/depth.md @@ -11,7 +11,7 @@ To find the depth of an array, use Depth (`≡`). For example, the depth of a li ≡ 2‿3‿4 ≡ "a string is a list of characters" -Depth is somewhat analogous to an array's rank `≠≢𝕩`, and in fact rank can be "converted" to depth by splitting rows with `<⎉1`, reducing the rank by 1 and increasing the depth. Unlike rank, Depth doesn't care at all about its argument's shape: +Depth is somewhat analogous to an array's rank `=𝕩`, and in fact rank can be "converted" to depth by splitting rows with `<⎉1`, reducing the rank by 1 and increasing the depth. Unlike rank, Depth doesn't care at all about its argument's shape: ≡ 3‿4⥊"characters" ≡ (1+↕10)⥊"characters" diff --git a/doc/transpose.md b/doc/transpose.md index 82123644..3e7bf5c3 100644 --- a/doc/transpose.md +++ b/doc/transpose.md @@ -45,7 +45,7 @@ And of course, Rank and Power can be combined to do more complicated transpositi Using these forms, we can state BQN's generalized matrix product swapping rule: - a MP b ←→ ⍉⍟(≠≢a) a ⍉⁼⊸MP⟜⍉ b + a MP b ←→ ⍉⍟(=a) a ⍉⁼⊸MP⟜⍉ b Certainly not as concise as APL's version, but not a horror either. BQN's rule is actually more parsimonious in that it only performs the axis exchanges necessary for the computation: it moves the two axes that will be paired with the matrix product into place before the product, and directly exchanges all axes afterwards. Each of these steps is equivalent in terms of data movement to a matrix transpose, the simplest nontrivial transpose to perform. Also remember that for two-dimensional matrices both kinds of transposition are the same, and APL's rule holds in BQN. @@ -80,7 +80,7 @@ In particular, the case with only one argument specified is interesting. Here, t ≢ 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˜)⊸⍉`. +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˜)⊸⍉`. ## Definitions @@ -88,6 +88,6 @@ Here we define the two valences of Transpose more precisely. A non-array right argument to Transpose is always enclosed to get a scalar array before doing anything else. -Monadic transpose is identical to `(≠∘≢-1˜)⊸⍉`, except that for scalar arguments it returns the array unchanged rather than giving an error. +Monadic transpose is identical to `(=-1˜)⊸⍉`, except that for scalar arguments it returns the array unchanged rather than giving an error. -In Dyadic transpose, the left argument is a number or numeric array of rank 1 or less, and `𝕨≤○≠≢𝕩`. Define the result rank `r←(≠≢𝕩)-+´¬∊𝕨` to be the argument rank minus the number of duplicate entries in the left argument. We require `∧´𝕨"a string is a list of characters" 1 -

Depth is somewhat analogous to an array's rank ≠≢𝕩, and in fact rank can be "converted" to depth by splitting rows with <1, reducing the rank by 1 and increasing the depth. Unlike rank, Depth doesn't care at all about its argument's shape:

+

Depth is somewhat analogous to an array's rank =𝕩, and in fact rank can be "converted" to depth by splitting rows with <1, reducing the rank by 1 and increasing the depth. Unlike rank, Depth doesn't care at all about its argument's shape:

     34"characters"
 1
      (1+↕10)"characters"
diff --git a/docs/doc/transpose.html b/docs/doc/transpose.html
index 2020a520..3b5af23b 100644
--- a/docs/doc/transpose.html
+++ b/docs/doc/transpose.html
@@ -53,7 +53,7 @@
  2 6 3 4 5 
 

Using these forms, we can state BQN's generalized matrix product swapping rule:

-
a MP b  ←→  (≠≢a) a MP b
+
a MP b  ←→  (=a) a MP b
 

Certainly not as concise as APL's version, but not a horror either. BQN's rule is actually more parsimonious in that it only performs the axis exchanges necessary for the computation: it moves the two axes that will be paired with the matrix product into place before the product, and directly exchanges all axes afterwards. Each of these steps is equivalent in terms of data movement to a matrix transpose, the simplest nontrivial transpose to perform. Also remember that for two-dimensional matrices both kinds of transposition are the same, and APL's rule holds in BQN.

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]:

@@ -80,10 +80,10 @@
     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˜).

+

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˜).

Definitions

Here we define the two valences of Transpose more precisely.

A non-array right argument to Transpose is always enclosed to get a scalar array before doing anything else.

-

Monadic transpose is identical to (≢-1˜), except that for scalar arguments it returns the array unchanged rather than giving an error.

-

In Dyadic transpose, the left argument is a number or numeric array of rank 1 or less, and 𝕨≠≢𝕩. Define the result rank r(≠≢𝕩)-+´¬∊𝕨 to be the argument rank minus the number of duplicate entries in the left argument. We require ´𝕨<r. Bring 𝕨 to full length by appending the missing indices: 𝕨𝕨(¬˜/⊢)r. Now the result shape is defined to be ´¨𝕨⊔≢𝕩. Element iz of the result z is element (𝕨i)𝕩 of the argument.

+

Monadic transpose is identical to (=-1˜), except that for scalar arguments it returns the array unchanged rather than giving an error.

+

In Dyadic transpose, the left argument is a number or numeric array of rank 1 or less, and 𝕨≠≢𝕩. Define the result rank r(=𝕩)-+´¬∊𝕨 to be the argument rank minus the number of duplicate entries in the left argument. We require ´𝕨<r. Bring 𝕨 to full length by appending the missing indices: 𝕨𝕨(¬˜/⊢)r. Now the result shape is defined to be ´¨𝕨⊔≢𝕩. Element iz of the result z is element (𝕨i)𝕩 of the argument.

diff --git a/docs/index.html b/docs/index.html index f57273e5..57e708ba 100644 --- a/docs/index.html +++ b/docs/index.html @@ -209,7 +209,7 @@ = - +Rank Equals diff --git a/dzref b/dzref index eabf24cf..4ce64b25 100755 --- a/dzref +++ b/dzref @@ -33,10 +33,10 @@ _depthOp_←{ _onAxes_←{ F←𝔽 (𝔾<≡)∘⊣◶{ # One axis - ! 1≤≠≢𝕩 + ! 1≤=𝕩 𝕨F𝕩 }‿{ # Multiple axes - ! 1≥≠≢𝕨 + ! 1≥=𝕨 ! 𝕨≤○≠≢𝕩 R←{(⊑𝕨)F(1↓𝕨)⊸R˘𝕩}⍟{0<≠𝕨} 𝕨R𝕩 @@ -45,7 +45,7 @@ _onAxes_←{ Windows←{ ! IsArray 𝕩 - ! 1≥≠≢𝕨 + ! 1≥=𝕨 ! 𝕨≤○≠≢𝕩 ! ∧´Nat¨⥊𝕨 s←(≠𝕨)↑≢𝕩 @@ -69,8 +69,8 @@ Join←{ s←≢¨𝕩 d←≠⊑s ! ∧´⥊d=≠¨s - ! d≥≠≢𝕩 - l←(≢𝕩){(𝕩⊑⟜≢a⊑˜(j=𝕩)⊸×)¨↕𝕨}¨j←↕r←≠≢a←𝕩 + ! d≥=𝕩 + l←(≢𝕩){(𝕩⊑⟜≢a⊑˜(j=𝕩)⊸×)¨↕𝕨}¨j←↕r←=a←𝕩 ! (r↑¨s)≡C l i←C{p←+´¨↑𝕩⋄(↕⊑⌽p)-𝕩/¯1↓p}¨l >i<¨⊸⊏¨l/𝕩 @@ -79,20 +79,20 @@ Join←{ ∾ ↩ Join ⊘ ∾ # Searching -IndexOf←(1<⌈○(≠≢))◶⊐‿{ - c←1-˜≠≢𝕨 +IndexOf←(1<⌈○=)◶⊐‿{ + c←1-˜=𝕨 ! 0≤c 𝕨 (0<≠𝕨)◶⟨0⎉c∘⊢,((+´<˘)∧`)≢⎉c⎉c‿∞⟩ 𝕩 } UniqueMask←{ - ! 1≤≠≢𝕩 + ! 1≤=𝕩 u←0↑𝕩 {(≠u)>⊑u IndexOf 𝕩}◶{u↩u∾𝕩⋄1}‿0˘𝕩 } Find←{ - r←≠s←≢𝕨 - ! r≤≠≢𝕩 - 𝕨 ≡⎉r s ↕⎉r 𝕩 + r←=𝕨 + ! r≤=𝕩 + 𝕨 ≡⎉r (≢𝕨) ↕⎉r 𝕩 } ⊐ ← !∘0 ⊘ IndexOf @@ -101,16 +101,16 @@ Find←{ ReorderAxes←{ 𝕩↩<⍟(0=≡)𝕩 - ! 1≥≠≢𝕨 + ! 1≥=𝕨 𝕨↩⥊𝕨 ! 𝕨≤○≠≢𝕩 ! ∧´Nat¨⥊𝕨 - r←(≠≢𝕩)-+´¬∊𝕨 + r←(=𝕩)-+´¬∊𝕨 ! ∧´𝕨)i⋄m}○(r↑⌽)t a←⥊𝕨⋄b←⥊𝕩 Trav←(=⟜l)◶{Trav∘(1+𝕩)⍟(0⊸=)a Cmp○(𝕩⊸⊑)b}‿c @@ -129,7 +129,7 @@ Cmp ← ∨○IsArray◶{ # No arrays } _bins←{ - c←1-˜≠≢𝕨 + c←1-˜=𝕨 ! 0≤c LE←𝔽⎉c≤0˜ ! (0<≠)◶⟨1,∧´·LE´˘2↕<˘⟩𝕨 @@ -147,7 +147,7 @@ ProgressiveIndexOf ← {𝕨⊐○(≍˘⟜OccurrenceCount𝕨⊸⊐)𝕩} X←Raw←{≤4} { chrs←⟨ - "!∾↕⌽⍉⍋⍒⊐⊒∊⍷" + "!=∾↕⌽⍉⍋⍒⊐⊒∊⍷" "" "⚇" ⟩ @@ -176,6 +176,7 @@ X←Raw←{≤4} ⍎"Type ← ⟨⟩⥊0⊸⥊" '!' Mod "{𝕩 ⋄ ≤1}⍟¬" + '=' Mod "≠∘≢ ⊘ =" Mod⟜⥊¨ "↕∾⌽⊐⍋⍒" diff --git a/md.bqn b/md.bqn index 657c4926..b55ad4f7 100644 --- a/md.bqn +++ b/md.bqn @@ -457,7 +457,7 @@ Fmt ← { p ↩ 0⌾(¯1⊸⊑) p Pad ← {i←/1+𝕨 ⋄ (¯1¨⌾((¬∊i)⊸/)i) ⊏ 𝕩∾(¯1⊑≢𝕩)⥊" "} p (⊑0∊ls)◶⟨Pad,+´⊸↑⟩ ((×´ls)∾¯1⊑≢𝕩) ⥊ 𝕩 - }⍟(2 < ≠∘≢) + }⍟(2 < =) # Horizontal padding: just some spaces on either side PadH ← { (𝕨/" ") (∾⎉1∾⎉1⊣) 𝕩 @@ -473,7 +473,7 @@ Fmt ← { (1∾-l)↑"┘" ⟩ } - FmtEmpty ← (0‿0≢≢)◶("┌┐"≍"└┘")‿(((2≠≠∘≢)∨0=≠)◶{ + FmtEmpty ← (0‿0≢≢)◶("┌┐"≍"└┘")‿(((2≠=)∨0=≠)◶{ '┐'⌾(0‿¯1⊸⊑) 2 Enframe 1 PadH " "¨𝕩 }‿{ ≍"⟨⟩"∾˜(1<≠)◶⟨"",'⥊'⌾(¯1⊸⊑)·∾·∾⟜"‿"¨⍕¨⟩≢𝕩 @@ -482,13 +482,13 @@ Fmt ← { s ← ≢¨ 𝕩 w ← ⌈´⥊<⎉1 1⊑¨s h ← ⌈´⎉1 ⊑¨s - ∾⎉2 ≍⍟(0⌈2-≠∘≢) (h ∾⌜ 𝕨×w¬(-𝕨×≠w)↑1) ↑¨ 𝕩 + ∾⎉2 ≍⍟(0⌈2-=) (h ∾⌜ 𝕨×w¬(-𝕨×≠w)↑1) ↑¨ 𝕩 } FmtMixed ← { - (≠≢𝕩) Enframe 2 Pad 𝕨 PaddingJoin F¨𝕩 + (=𝕩) Enframe 2 Pad 𝕨 PaddingJoin F¨𝕩 } F ← (2⌊≡)◶(≍≤⟜∞◶⟨"'"⊸(∾∾⊣),⍕⟩)‿{ - num ← 𝕩≤∞ ⋄ r ← ≠≢𝕩 + num ← 𝕩≤∞ ⋄ r ← =𝕩 ((≠(0⊸<+≤)+´)⥊num)◶{ # All characters k ← -≠ c ← ¯1↓≢𝕩 diff --git a/spec/reference.bqn b/spec/reference.bqn index bba39aef..5d5424d8 100644 --- a/spec/reference.bqn +++ b/spec/reference.bqn @@ -23,7 +23,7 @@ ÷ # Reciprocal Divide ⋆ # Exponential Power ⌊ # Floor -= # Equals += # Rank Equals ≤ # Less Than or Equal to # Other basic functionality that we need to assume @@ -77,13 +77,13 @@ _eachm←{ E 0 ⋄ (≢𝕩)⥊r } _reduce←{ - ! 1=≠≢𝕩 + ! 1==𝕩 l←≠v←𝕩 ⋄ F←𝔽 r←𝕨 (0○(≠≢))◶⟨𝔽_e⋄𝔽˜_e˜⟩ + (>○=)◶⟨𝔽_e⋄𝔽˜_e˜⟩ } _perv←{ # Pervasion (⊢⊘∨○IsArray)◶⟨𝔽⋄𝔽{𝕨𝔽_perv𝕩}¨⟩ @@ -129,7 +129,7 @@ Nat←IsArray◶⟨0⊸≤∧⌊⊸=,0⟩ Deshape←IsArray◶{⟨𝕩⟩}‿⥊ Reshape←{ - ! 1≥≠≢𝕨 + ! 1≥=𝕨 𝕨↩⥊𝕨 ! ∧´Nat¨𝕨 n←≠𝕩 ⋄ l←×´𝕨 @@ -139,12 +139,12 @@ Reshape←{ Range←{ I←{!Nat𝕩⋄↕𝕩} - M←{!1=≠≢𝕩⋄(<⟨⟩)⥊⊸∾⌜´I¨𝕩} + M←{!1==𝕩⋄(<⟨⟩)⥊⊸∾⌜´I¨𝕩} IsArray◶I‿M 𝕩 } Pick1←{ - ! 1=≠≢𝕨 + ! 1==𝕨 ! 𝕨=○≠s←≢𝕩 ! ∧´Int¨𝕨 ! ∧´𝕨(≥⟜-∧<)s @@ -157,7 +157,7 @@ Pick←IsArray◶⥊‿⊢⊸Pickd match←{¬∘(0⊑𝕨)◶(1⊑𝕨)‿𝕩}´⟨ ⟨≠○IsArray , 0⟩ ⟨¬IsArray∘⊢, =⟩ - ⟨≠○(≠≢) , 0⟩ + ⟨≠○= , 0⟩ ⟨∨´≠○≢ , 0⟩ {∧´⥊𝕨Match¨𝕩} ⟩ @@ -203,7 +203,7 @@ _depthOp_←{ 𝕨 n _d 𝕩 } _rankOp_←{ - k←𝕨(Pair○(≠≢) (0≤⊢)◶⟨⌊⟜-,0⌈-⟩¨ 𝔾_ranks)𝕩 + k←𝕨(Pair○= (0≤⊢)◶⟨⌊⟜-,0⌈-⟩¨ 𝔾_ranks)𝕩 Enc←{ f←⊑⟜(≢𝕩)¨↕𝕨 c←×´s←𝕨Cell𝕩 @@ -213,7 +213,7 @@ _rankOp_←{ } _scan←{ ! IsArray 𝕩 - ! 1≤≠≢𝕩 + ! 1≤=𝕩 F←𝔽 (0<≠∘⥊)◶⊢‿{ r←⥊𝕩 ⋄ l←≠𝕩 ⋄ c←×´1 Cell 𝕩 @@ -245,10 +245,10 @@ _iterate_←{ _onAxes_←{ F←𝔽 (𝔾<≡)∘⊣◶{ # One axis - ! 1≤≠≢𝕩 + ! 1≤=𝕩 𝕨F𝕩 }‿{ # Multiple axes - ! 1≥≠≢𝕨 + ! 1≥=𝕨 ! 𝕨≤○≠≢𝕩 R←{(⊑𝕨)F(1 DropV 𝕨)⊸R˘𝕩}⍟{0<≠𝕨} 𝕨R𝕩 @@ -288,12 +288,12 @@ Drop←{ s←(≠𝕨)(⊣↑⊢∾˜1⥊˜0⌈-⟜≠)≢𝕩 ((sׯ1⋆𝕨>0)+(-s)⌈s⌊𝕨)↑𝕩 } -Prefixes ← {!1≤≠≢𝕩 ⋄ (↕1+≠𝕩)Take¨<𝕩} -Suffixes ← {!1≤≠≢𝕩 ⋄ (↕1+≠𝕩)Drop¨<𝕩} +Prefixes ← {!1≤=𝕩 ⋄ (↕1+≠𝕩)Take¨<𝕩} +Suffixes ← {!1≤=𝕩 ⋄ (↕1+≠𝕩)Drop¨<𝕩} Windows←{ ! IsArray 𝕩 - ! 1≥≠≢𝕨 + ! 1≥=𝕨 ! 𝕨≤○≠≢𝕩 ! ∧´Nat¨⥊𝕨 s←(≠𝕨)↑≢𝕩 @@ -301,16 +301,16 @@ Windows←{ 𝕨{(∾⟜(𝕨≠⊸↓≢𝕩)∘≢⥊>)<¨⊸⊏⟜𝕩¨s(¬+⌜○↕⊢)⥊𝕨}⍟(0<≠𝕨)𝕩 } -Reverse ← {!1≤≠≢𝕩 ⋄ (-↕⊸¬≠𝕩)⊏𝕩} +Reverse ← {!1≤=𝕩 ⋄ (-↕⊸¬≠𝕩)⊏𝕩} Rotate ← {!Int𝕨 ⋄ l←≠𝕩⋄(l|𝕨+↕l)⊏𝕩} _onAxes_ 0 Indices←{ - ! 1=≠≢𝕩 + ! 1==𝕩 ! ∧´Nat¨𝕩 ⟨⟩∾´𝕩⥊¨↕≠𝕩 } Rep ← Indices⊸⊏ -Replicate ← {0<≠≢𝕨}◶(⥊˜⟜≠Rep⊢)‿{!𝕨=○≠𝕩⋄𝕨Rep𝕩} _onAxes_ (1-0=≠) +Replicate ← {0<=𝕨}◶(⥊˜⟜≠Rep⊢)‿{!𝕨=○≠𝕩⋄𝕨Rep𝕩} _onAxes_ (1-0=≠) #⌜ @@ -334,8 +334,8 @@ Join←{ s←≢¨𝕩 d←≠⊑s ! ∧´⥊d=≠¨s - ! d≥≠≢𝕩 - l←(≢𝕩){(𝕩⊑⟜≢a⊑˜(j=𝕩)⊸×)¨↕𝕨}¨j←↕r←≠≢a←𝕩 + ! d≥=𝕩 + l←(≢𝕩){(𝕩⊑⟜≢a⊑˜(j=𝕩)⊸×)¨↕𝕨}¨j←↕r←=a←𝕩 ! (r↑¨s)≡C l i←C{p←+´¨↑𝕩⋄(↕⊑⌽p)-𝕩/¯1↓p}¨l >i<¨⊸⊏¨l/𝕩 @@ -343,8 +343,8 @@ Join←{ Group←{ ! IsArray 𝕩 - Chk←{!1=≠≢𝕩⋄!∧´Int¨𝕩⋄!∧´¯1≤𝕩⋄≠𝕩} - l←(1<≡)◶Chk‿{!1=≠≢𝕩⋄Chk¨𝕩}𝕨 + Chk←{!1==𝕩⋄!∧´Int¨𝕩⋄!∧´¯1≤𝕩⋄≠𝕩} + l←(1<≡)◶Chk‿{!1==𝕩⋄Chk¨𝕩}𝕨 ! l≤○≠≢𝕩 ! ∧´l=l≠⊸↑≢𝕩 (𝕨⊸=/𝕩˜)¨↕1+¯1⌈´⚇1𝕨 @@ -352,33 +352,33 @@ Group←{ # Searching IndexOf←{ - c←1-˜≠≢𝕨 + c←1-˜=𝕨 ! 0≤c 𝕨 (0<≠𝕨)◶⟨0⎉c∘⊢,((+´<˘)∧`)≢⎉c⎉c‿∞⟩ 𝕩 } UniqueMask←{ - ! 1≤≠≢𝕩 + ! 1≤=𝕩 u←0↑𝕩 {⊑𝕩∊u}⊘{u↩u∾𝕩⋄1}‿0˘𝕩 } Find←{ - r←≠s←≢𝕨 - ! r≤≠≢𝕩 - 𝕨 ≡⎉r s ↕⎉r 𝕩 + r←=𝕨 + ! r≤=𝕩 + 𝕨 ≡⎉r (≢𝕨) ↕⎉r 𝕩 } ReorderAxes←{ 𝕩↩<⍟(0=≡)𝕩 - ! 1≥≠≢𝕨 + ! 1≥=𝕨 𝕨↩⥊𝕨 ! 𝕨≤○≠≢𝕩 ! ∧´Nat¨⥊𝕨 - r←(≠≢𝕩)-+´¬∊𝕨 + r←(=𝕩)-+´¬∊𝕨 ! ∧´𝕨)i⋄m}○(r↑⌽)t a←⥊𝕨⋄b←⥊𝕩 Trav←(=⟜l)◶{Trav∘(1+𝕩)⍟(0⊸=)a Cmp○(𝕩⊸⊑)b}‿c @@ -396,11 +396,11 @@ Cmp ← ∨○IsArray◶{ # No arrays } _grade←{ - ! 1≤≠≢𝕩 + ! 1≤=𝕩 i⊐˜+´˘(𝔽⎉∞‿¯1⎉¯1‿∞˜𝕩)(⌈⟜0+=⟜0⊸×)>⌜˜i←↕≠𝕩 } _bins←{ - c←1-˜≠≢𝕨 + c←1-˜=𝕨 ! 0≤c LE←𝔽⎉c≤0˜ ! (0<≠)◶⟨1,∧´·LE´˘2↕<˘⟩𝕨 diff --git a/test/testref.bqn b/test/testref.bqn index d6217106..62b40719 100644 --- a/test/testref.bqn +++ b/test/testref.bqn @@ -187,7 +187,7 @@ (≍˘˜⥊˘1‿5‿9)≡⌽⎉2⊸+⥊⟜(↕×´)3‿2‿1 (↕4)(×⌜≡×⎉0‿2)↕5 (↕4)(⋆˜⌜˜≡⋆⎉∞‿¯4)↕5 - (⟨2⟩⊸∾⍟(2‿2⥊0‿1‿1‿1)2‿3)≡≢¨≍⎉(⌊○(≠≢))⌜˜⟨↕3,2‿3⥊↕6⟩ + (⟨2⟩⊸∾⍟(2‿2⥊0‿1‿1‿1)2‿3)≡≢¨≍⎉(⌊○=)⌜˜⟨↕3,2‿3⥊↕6⟩ (2=⌜○↕3)≡(2‿4⥊"abc")≡⎉1(2‿3‿4⥊"abc") ⟨0,0⟩≡(2‿4⥊"abc")≡⎉¯1(2‿3‿4⥊"abc") ⟨5,⟨15,1⟩⟩≡+´⚇1⟨⟨3,2⟩,⟨⟨4,5,6⟩,⟨1⟩⟩⟩ -- cgit v1.2.3