From 6b977a7c60ac80a0aa66a9c04ca7944edd49f70c Mon Sep 17 00:00:00 2001 From: Matthew Lutze Date: Mon, 6 Oct 2025 08:36:58 +0200 Subject: [PATCH] remove uses of enumerator --- src/BoardLibrary.flix | 4 ++-- src/Noise.flix | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/BoardLibrary.flix b/src/BoardLibrary.flix index eed290b..cb13adf 100644 --- a/src/BoardLibrary.flix +++ b/src/BoardLibrary.flix @@ -83,8 +83,8 @@ mod Flixball.BoardLibrary { def gridToMap(g: Array[Array[Bool, r], r]): Map[(Int32, Int32), Tile] \ r = region rh { let mutTiles = MutMap.empty(rh); foreach( - (x, arr) <- Array.enumerator(rh, g) |> Iterator.toList; // TODO wasted traversal - (y, b) <- Array.enumerator(rh, arr) |> Iterator.toList // TODO wasted traversal + (x, arr) <- Array.iterator(rh, g) |> Iterator.zipWithIndex |> Iterator.toList; // TODO wasted traversal + (y, b) <- Array.iterator(rh, arr) |> Iterator.zipWithIndex |> Iterator.toList // TODO wasted traversal ) { if (b) mutTiles |> MutMap.put((x, y), Wall) else () diff --git a/src/Noise.flix b/src/Noise.flix index 6ab1b49..52161b6 100644 --- a/src/Noise.flix +++ b/src/Noise.flix @@ -52,8 +52,8 @@ mod Flixball.Noise { // and the swapping them. def simulationStep(iteration) = if (iteration <= 0) () else { foreach( - (x, arr) <- Array.enumerator(r1, Ref.get(current)) |> Iterator.toList; // TODO wasted traversal - (y, _) <- Array.enumerator(r1, arr) |> Iterator.toList) // TODO wasted traversal + (x, arr) <- Array.iterator(r1, Ref.get(current)) |> Iterator.zipWithIndex |> Iterator.toList; // TODO wasted traversal + (y, _) <- Array.iterator(r1, arr) |> Iterator.zipWithIndex |> Iterator.toList) // TODO wasted traversal { let p = {x = x, y = y}; let nbh = mooreNeighborhood(p, d);