We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0c7291e commit dd7cd09Copy full SHA for dd7cd09
spec/reference.bqn
@@ -513,8 +513,8 @@ _bins←{
513
𝕨 (0<≠𝕨)◶⟨0⎉c∘⊢,+˝LE⎉¯1‿∞⟩ 𝕩 # Number of 𝕨 cells preceding or matching each 𝕩 cell
514
}
515
516
-# ⊐˜ ranks without breaking ties and ⍋∘⍋ breaks ties, so the
517
-# difference after adjusting ⊐˜ is the occurrence count
518
-OccurrenceCount ← ⊐˜(⊢-⊏)⍋∘⍋
+# In the result of ⍋⍋, matching cells get consecutive indices
+# Select with ⊐˜ to get the first, and subtract for the occurrence count
+OccurrenceCount ← (⊢-⊏)⟜(⍋⍋)⊐˜
519
# Tag each cell with an occurrence count, then search
520
ProgressiveIndexOf ← {𝕨⊐○(((≢∾2˙)⥊≍˘⟜OccurrenceCount∘⥊)𝕨⊸⊐)𝕩}
0 commit comments