mulias / roc-array2d

Fixed size 2D arrays for Roc
ISC License
5 stars 0 forks source link

walkWithIndex #3

Closed ryanb closed 9 months ago

ryanb commented 9 months ago

I ran into the need for walkWithIndex, would you like a PR for this?

mulias commented 9 months ago

Hey Ryan, if you look at the signature for walk you'll see that it already provides the index

walk : Array2D a, state, WalkOptions *, (state, a, Index -> state) -> state

In many cases where List has a WithIndex version I've opted for providing the index by default, since it's commonly helpful in this context. This is probably something where hosting the docs (#1) will make things more clear.

Does that make sense?

ryanb commented 9 months ago

@mulias awesome, I missed that. I just looked at the name. Thanks!