How shall I write the method in Erlang

```
for_loop_with_index_and_value(F, L)

```

which is the analog of loop in Go

```
for index, value := range array {
    F(index, value)
}

```

I have read [foreach loop with counter](https://stackoverflow.com/questions/4777152/foreach-loop-with-counter)
but I can't rewrite

```
lists:foldl(fun(E,Cnt) -> ..., Cnt+1 end, 0, Y)

```

so that F not return next index.

Ok, thank you all very much. Why

```
for_loop_with_index_and_value(fun(I, V) -> calc(I, V) end, L)

```

work but

```
for_loop_with_index_and_value(fun calc/2, L)

```

doesn't work?