From b2374aef747b4988417f896fdf33852dd57b9b07 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Wed, 3 Feb 2021 13:43:13 -0500 Subject: Rename Unique Mask to Mark Firsts --- spec/primitive.md | 4 ++-- spec/reference.bqn | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'spec') diff --git a/spec/primitive.md b/spec/primitive.md index 5fc15001..829729f8 100644 --- a/spec/primitive.md +++ b/spec/primitive.md @@ -165,9 +165,9 @@ For **Select** (`⊏`), `𝕨` is an array of natural numbers, or a list of such **Match** (`≑`) indicates whether two values are considered equivalent. It always returns 0 or 1, and never causes an error. If both arguments are atoms then it is identical to `=`, and if one is an atom and the other an array then it returns 0. If both arguments are arrays then it returns 1 only if they have the same shape and all pairs of corresponding elements match. Fill elements aren't taken into account, so that arrays that match might still differ in behavior. **Not Match** simply returns the complement of Match, `¬≑`. -Monadic search functions compare the major cells of `𝕩` to each other. `𝕩` must have rank at least 1. Except for Unique (`⍷`), the result is a list of numbers with the same length as `𝕩`. +Monadic search functions compare the major cells of `𝕩` to each other. `𝕩` must have rank at least 1. Except for Deduplicate (`⍷`), the result is a list of numbers with the same length as `𝕩`. -- **Unique Mask** (`∊`) returns 1 for a cell if it doesn't match any earlier cell and 0 if it does. +- **Mark Firsts** (`∊`) returns 1 for a cell if it doesn't match any earlier cell and 0 if it does. - **Deduplicate** (`⍷`) filters major cells to remove duplicates, retaining the ordering given by the first appearance of each unique cell. - **Classify** (`⊐`) returns, for each cell, the smallest index of a cell that matches it (it's necessarily less than or equal to `↕≠𝕩` element-wise, since each cell matches itself). - **Occurrence Count** (`βŠ’`) returns the number of earlier cells matching each cell. diff --git a/spec/reference.bqn b/spec/reference.bqn index bdfc1f2c..42949e56 100644 --- a/spec/reference.bqn +++ b/spec/reference.bqn @@ -354,7 +354,7 @@ Replicate ← {0<=𝕨}β—Ά(β₯ŠΛœβŸœβ‰ Rep⊒)β€Ώ{!𝕨=○≠𝕩⋄𝕨Rep𝕩} βŠ” ← βŠ”βŸœ(β†•β‰ βš‡1) ⊘ Group ⍉ ← Transpose ⊘ ReorderAxes ⊐ ← ⍷⊸⊐ ⊘ IndexOf -∊ ← UniqueMask ⊘ (⊐˜<β‰ βˆ˜βŠ’) +∊ ← MarkFirst ⊘ (⊐˜<β‰ βˆ˜βŠ’) ⍷ ← ∊⊸/ ⊘ Find ⍋ ← Cmp _grade ⊘ ( Cmp _bins) ⍒ ← -∘Cmp _grade ⊘ (-∘Cmp _bins) @@ -398,7 +398,7 @@ IndexOf←{ ! c≀=𝕩 𝕨 (0<≠𝕨)β—ΆβŸ¨0βŽ‰c∘⊒,(+˝∧`)β‰’βŽ‰cβŽ‰cβ€ΏβˆžβŸ© 𝕩 } -UniqueMask←{ +MarkFirst←{ ! 1≀=𝕩 u←0↑𝕩 {βŠ‘π•©βˆŠu}⊘{u↩uβˆΎπ•©β‹„1}β€Ώ0Λ˜π•© -- cgit v1.2.3