I just came through an Advent of Code problem that would benefit from a List.walkBackwardsWithIndex
. Would y'all consider this function, alongside walkWithIndex
and walkUntilWithIndex
, to be useful for the Standard Library?
I have no strong preference either way, but i do want to note it is very easy to create those functions. Just make your state a record with one of the values being the index.
List.walk list {index: 0, state: ...) \{index, state}, elem -> ...
Just need to increment/decrement index on each iteration.
yeah I think that one's easy enough to do with walk
itself that it's not worth a separate function :big_smile:
@Brendan Hansknecht That's precisely the way that I implemented my function.
Last updated: Jul 06 2025 at 12:14 UTC