We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3e182f6 commit 2b52394Copy full SHA for 2b52394
src/algorithm/monadic/mod.rs
@@ -1547,6 +1547,9 @@ impl<T: ArrayValue> Array<T> {
1547
}
1548
/// Count the number of unique rows in the array
1549
pub fn count_unique(&self) -> usize {
1550
+ if self.element_count() == 0 && self.row_count() > 0 {
1551
+ return 1;
1552
+ }
1553
let mut seen = HashSet::new();
1554
self.row_slices()
1555
.filter(|row| seen.insert(ArrayCmpSlice(row)))
tests/optimized.ua
@@ -129,6 +129,9 @@ F ← /◇⊂
129
⍤⤙≍ ⊃(⧻∘⊚|⧻⊚) [1 0 3]
130
⍤⤙≍ ⊃(⧻∘⊚|⧻⊚) [1 0 1 0 1 0 1]
131
132
+# Count unique
133
+⍤⤙≍ ⊃(⧻∘◴|⧻◴) °△ 1_0
134
+
135
# Depth deshape
136
⍤⤙≍ ⊃≡(♭∘)≡♭ °△2_2_3_3
137
⍤⤙≍ ⊃≡(♭₀∘)≡♭₀ °△2_2_3_3
0 commit comments