David’s solution seems to work. I modified it so you can do steps:
foo:
1x12 => A,B,C,D,E,F,G,H,I,INT,INT,INT
repeat 3 { mv[-{1+$<}] {($1+1)*$>+$1} }
And my test:
C:\Windows\System32>gmic foo 3 echo ${lof\ n} rm
[gmic]./ Start G'MIC interpreter (v.3.3.6).
A,B,C,INT,D,E,F,INT,G,H,I,INT
[gmic]./ Remove images [0,1,2,(...),9,10,11] (0 images left).
[gmic]./ End G'MIC interpreter.
lof returns a list of specified features along images. n is name, so you can see names here.
Your code can use this:
foo: repeat $1 { mv[-{1+$<}] {($2+1)*$>+$2} } # $1 = number of times. $2 = step size.
Also, I would look into different solution. I almost never need to use move in arbitrary order. Actually, literally never now that I taken a check at reptorian.gmic.
Also, there could if break rule in case there’s issues or other things.