Right now, I haven’t made any new filters, I decided to try to improve G’MIC coding workflow via python and small scripts:
# Source of base code: https://www.techiedelight.com/find-permutations-string-cpp-java-iterative/
rep_find_permutation:
check "$1>1&&isint($1)"
$1,1,1,1,x
outstring="\n"
eval "
s=crop(#-1);
iter=1;
revert(q)=(
a=s;
n=$1-1;
for(p=q,p<$1,p++,
a[p]=s[n];
n--;
);
a;
);
m=0;
while(1,
run('outstring.=',vtos(s),'\\n');
i=$1-1;
while(s[i-1]>=s[i],
i--;
if(!i,m=1;break(););
);
m?break();
j=$1-1;
while(j>i && s[j] <= s[i-1],
j--;
);
swap(s[i-1],s[j]);
s=revert(i);
iter++;
);
run('iter=',iter);"
echo $outstring-$iter
rm.
The code above generates all permutations up to a number. I find it pretty useful for my needs.
Still needs more work, but it’ll be there.
The base is now proper. It now looks like this:
C:\Windows\System32>gmic rep_find_permutation 4
[gmic]-0./ Start G'MIC interpreter.
[gmic]-1./rep_find_permutation/
0,1,2,3
0,1,3,2
0,2,1,3
0,2,3,1
0,3,1,2
0,3,2,1
1,0,2,3
1,0,3,2
1,2,0,3
1,2,3,0
1,3,0,2
1,3,2,0
2,0,1,3
2,0,3,1
2,1,0,3
2,1,3,0
2,3,0,1
2,3,1,0
3,0,1,2
3,0,2,1
3,1,0,2
3,1,2,0
3,2,0,1
3,2,1,0
-24