From ff953589c5edd8a7745849d31e4237b89c92e9ea Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Sun, 9 Aug 2020 08:33:30 -0400 Subject: dzaima/BQN now supports Bins --- dzref | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) (limited to 'dzref') diff --git a/dzref b/dzref index 03c14965..25aca0bd 100755 --- a/dzref +++ b/dzref @@ -104,41 +104,16 @@ ReorderAxes←{ Transpose←(=-1˜)⊸ReorderAxes⍟(0<=) ⍉ ← Transpose ⊘ ReorderAxes -# Sorting -Cmp ← ∨○IsArray◶{ # No arrays - 𝕨(>-<)𝕩 # Assume they're numbers -}‿{ # At least one array - e←𝕨-˜○(0∨´0=≢)𝕩 - 𝕨(e=0)◶e‿{ - c←𝕨×∘-○(IsArray+=)𝕩 - s←≢𝕨 ⋄ t←≢𝕩 ⋄ r←𝕨⌊○=𝕩 - l←s{i←+´∧`𝕨=𝕩⋄m←1×´i↑𝕨⋄{c↩×-´𝕩⋄m↩m×⌊´𝕩}∘(⊑¨⟜𝕨‿𝕩)⍟(r⊸>)i⋄m}○(r↑⌽)t - a←⥊𝕨⋄b←⥊𝕩 - Trav←(=⟜l)◶{Trav∘(1+𝕩)⍟(0⊸=)a Cmp○(𝕩⊸⊑)b}‿c - Trav 0 - }𝕩 -} - -_bins←{ - c←1-˜=𝕨 - ! 0≤c - LE←𝔽⎉c≤0˜ - ! (0<≠)◶⟨1,∧´·LE˝˘2↕⊢⟩𝕨 - 𝕨 (0<≠𝕨)◶⟨0⎉c∘⊢,+˝LE⎉¯1‿∞⟩ 𝕩 -} - OccurrenceCount ← ⊐˜(⊢-⊏)⍋∘⍋ ProgressiveIndexOf ← {𝕨⊐○(≍˘⟜OccurrenceCount𝕨⊸⊐)𝕩} -⍋ ↩ ⍋ ⊘ ( Cmp _bins) -⍒ ↩ ⍒ ⊘ (-∘Cmp _bins) ⊒ ← OccurrenceCount⊘ ProgressiveIndexOf " X←Raw←{≤4} { chrs←⟨ - "!∾↕⌽⍉⍋⍒⊐⊒∊⍷" + "!∾↕⌽⍉⊐⊒∊⍷" "" "⚇" ⟩ @@ -162,7 +137,7 @@ X←Raw←{≤4} ⍎¨ ⟨ "IsArray ← 0≠≡" '!' Mod "{𝕩 ⋄ ≤1}⍟¬" - ⟩∾Mod⟜⥊¨ "↕∾⌽⊐⍋⍒" + ⟩∾Mod⟜⥊¨ "↕∾⌽⊐" # checks if line is a builtin redefinition -- cgit v1.2.3