diff --git a/src/zip/mod.rs b/src/zip/mod.rs
index 333911c6b..ed92e2509 100644
--- a/src/zip/mod.rs
+++ b/src/zip/mod.rs
@@ -691,12 +691,14 @@ impl
Zip
where
D: Dimension,
{
- fn apply_core(&mut self, acc: Acc, function: F) -> FoldWhile
+ fn apply_core(&mut self, acc: Acc, mut function: F) -> FoldWhile
where
F: FnMut(Acc, P::Item) -> FoldWhile,
P: ZippableTuple,
{
- if self.layout.is(CORDER | FORDER) {
+ if self.dimension.ndim() == 0 {
+ function(acc, unsafe { self.parts.as_ref(self.parts.as_ptr()) })
+ } else if self.layout.is(CORDER | FORDER) {
self.apply_core_contiguous(acc, function)
} else {
self.apply_core_strided(acc, function)
diff --git a/tests/azip.rs b/tests/azip.rs
index 9027927ff..b553d7fb5 100644
--- a/tests/azip.rs
+++ b/tests/azip.rs
@@ -303,6 +303,19 @@ fn test_clone() {
});
}
+#[test]
+fn test_indices_0() {
+ let a1 = arr0(3);
+
+ let mut count = 0;
+ Zip::indexed(&a1).apply(|i, elt| {
+ count += 1;
+ assert_eq!(i, ());
+ assert_eq!(*elt, 3);
+ });
+ assert_eq!(count, 1);
+}
+
#[test]
fn test_indices_1() {
let mut a1 = Array::default(12);