Skip to content

Commit dd7cd09

Browse files
committed
Improved OccurrenceCount implementation, doesn't grade the argument
1 parent 0c7291e commit dd7cd09

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

spec/reference.bqn

+3-3
Original file line numberDiff line numberDiff line change
@@ -513,8 +513,8 @@ _bins←{
513513
𝕨 (0<≠𝕨)0c,+˝LE¯1𝕩 # Number of 𝕨 cells preceding or matching each 𝕩 cell
514514
}
515515

516-
# ⊐˜ ranks without breaking ties and ⍋∘⍋ breaks ties, so the
517-
# difference after adjusting ⊐˜ is the occurrence count
518-
OccurrenceCount˜(⊢-⊏)
516+
# In the result of ⍋⍋, matching cells get consecutive indices
517+
# Select with ⊐˜ to get the first, and subtract for the occurrence count
518+
OccurrenceCount ← (⊢-⊏)(⍋⍋)˜
519519
# Tag each cell with an occurrence count, then search
520520
ProgressiveIndexOf ← {𝕨(((≢∾2˙)⥊≍˘OccurrenceCount)𝕨)𝕩}

0 commit comments

Comments
 (0)