arc> (on x (obj 0 'a 1 'b 2 'c 3 'd) (prs index x) (prn))
0 a
1 b
2 c
3 d
nil
But using each on a table doesn't guarantee this ordering on the keys.
arc> (each (k v) (obj 0 'a 1 'b 2 'c 3 'd) (prs k v) (prn))
2 c
1 b
0 a
3 d
#hash((3 . d) (0 . a) (1 . b) (2 . c))
I wonder why you'd want index bound if you aren't iterating through integer keys in order. Do you have an example? Seems like there should be one, but I can't think of it.
Yeah here's a use case. I wrote a macro called everyp to overlay atop each with a progress indicator. It prints out the number of iterations at the start and a heartbeat every n iterations. I found this bug when I tried to everyp (implemented using on) over a table.