From 35b312299a40ac6fc1725901e99b62239be2e5c9 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Wed, 1 Jul 2020 19:09:08 -0400 Subject: Test layer 6 structural and search functions --- spec/reference.bqn | 46 +++++++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 21 deletions(-) (limited to 'spec/reference.bqn') diff --git a/spec/reference.bqn b/spec/reference.bqn index 9c82cda1..241be28a 100644 --- a/spec/reference.bqn +++ b/spec/reference.bqn @@ -317,7 +317,7 @@ Replicate ← {0<≠≢𝕨}◶(⥊˜⟜≠Rep⊢)‿{!𝕨=○≠𝕩⋄𝕨Rep ⍝ LAYER 6: Everything else ∾ ↩ Join ⊘ JoinTo -⊔ ← ⊔⟜(↕∘≠⚇1) ⊘ Group +⊔ ← ⊔⟜(↕≠⚇1) ⊘ Group ⍉ ← Transpose ⊘ ReorderAxes ⊐ ← !∘0 ⊘ IndexOf ∊ ← UniqueMask ⊘ (⊐˜<≠∘⊢) @@ -332,11 +332,11 @@ Join←{ C←(<⟨⟩)⥊⊸∾⌜´⊢ ⍝ Cartesian array product ! IsArray 𝕩 s←≢¨𝕩 - c←≠⊑s - ! ∧´c=≠¨s - ! c≥≠≢𝕩 - l←(≢𝕩){(𝕩⊑a⊑˜(j=𝕩)⊸×)¨↕𝕨}¨j←↕≠≢a←𝕩 - ! s≡C l + d←≠⊑s + ! ∧´⥊d=≠¨s + ! d≥≠≢𝕩 + l←(≢𝕩){(𝕩⊑⟜≢a⊑˜(j=𝕩)⊸×)¨↕𝕨}¨j←↕r←≠≢a←𝕩 + ! (r↑¨s)≡C l i←C{p←+´¨↑𝕩⋄(↕⊑⌽p)-𝕩/¯1↓p}¨l >i<¨⊸⊏¨l/𝕩 }⍟(0<≠∘⥊) @@ -347,35 +347,39 @@ Group←{ l←(1<≡)◶Chk‿{!1=≠≢𝕩⋄Chk¨𝕩}𝕨 ! l≤○≠≢𝕩 ! ∧´l=l≠⊸↑≢𝕩 - (𝕨⊸=/𝕩˜)¨↕1+0⌈´⚇1𝕨 + (𝕨⊸=/𝕩˜)¨↕1+¯1⌈´⚇1𝕨 } -ReorderAxes←{ - 𝕩↩<⍟(0=≡)𝕩 - ! 𝕨≤○≠≢𝕩 - r←(≠≢𝕩)-+´¬∊𝕨 - ! ∧´𝕨-<)𝕩 ⍝ Assume they're numbers @@ -393,7 +397,7 @@ Cmp ← ∨○IsArray◶{ ⍝ No arrays _grade←{ ! 1≤≠≢𝕩 - i⊐+´˘(𝔽⎉∞‿¯1⎉¯1‿∞˜𝕩)(⌈⟜0+=⟜0⊸×)>⌜˜i←↕≠𝕩 + i⊐˜+´˘(𝔽⎉∞‿¯1⎉¯1‿∞˜𝕩)(⌈⟜0+=⟜0⊸×)>⌜˜i←↕≠𝕩 } _bins←{ r←1-˜≠≢𝕨 -- cgit v1.2.3