Perhaps I have missed something in the reference, but I was playing and I wanted to reorder a large image list painstakingly invoking move. I made a custom command to reorder the list based on a string input. The string is the index numbers in the images in the new list order. For example:
reorder_list 0,2,4,6,8,1,3,5,7
moves every second image to the end of the list.
I thought this would make a useful addition to GMIC but I am not familiar enough with the cli and dealing with strings to make a robust and elegant command.
I took your idea about naming images and came up with this.
#@gui reorder_list: reorder_list, reorder_list
#@gui : order = text (0,"1,2,3,4,8,7,6,5,0)
reorder_list:
#generate sample images
-rm
-repeat 9
sample $>
-text_outline[$>] $>,0,0,50%,1,1,255 # make it obvious which image is which
-done
($1) #enter new order as image
-repeat {$!-1} # name images as letters so sorting alphabetcally will give the new order
-name[{-1,i($>)}] {`[{97+$>}]`}
-done
-rm[-1] #remove image of new order values
-repeat {$!} #move 'a'...'N' to end of list until 'a' becomes the first image
image_name={`[{97+$>}]`}
-move[$image_name] {$!}
-done
Learnt some things doing that.
This suits my needs but to be useful for everybody a command like this would need to handle issues like having repted values in the new order etc.
Correct: my current implementation in the PR doesn’t account for repeated values yet (e.g., 0,3,5,4,3,1), but it can take any number of values (doesn’t have to match the number of images) and can handle skipped values in the counting sequence (e.g., 0,3,5,4,7,1).
Incorporated sort_list in afre_reorder (submitted a PR). It deals with duplicate values but removes the possibility of accepting a numbered list of any length, so I had to reintroduce the feature.
PS My laptop just crashed; it has been like this for the past several years. Fortunately, my changes were committed beforehand.  (If anyone has a laptop to spare…)
Remarks: I am liking the permutation, combination, ncr things I made. Comes in handy.
Also, someone did point to me to a Python method of doing this (which doesn’t apply to G’MIC, but the method is what should be paid attention to):
def f(a):
seq = [i for i in range(len(a))]
seq_copy = [i for i in range(len(a))]
for i, n in enumerate(a):
seq_ = [s for j, s in enumerate(seq_copy[i:]) if j != n]
seq = seq[:i] + [n] + seq_
return seq