New useful features in math parser, planned in 2.9.8

A quick coding and testing here leads me to this.

rep_hex2img_test:
if narg($1)&&narg($2)
 hex2img $1
 hex2img $2
 hex_col_a={crop(#-2)}
 hex_col_b={crop(#-1)}
 rm[-2,-1]
fi

c=4
1,500,1,3,"begin(
 a=["$hex_col_a"];
 print(a);
 c=$c;
 print(c);
);
1;
"

For multiple numbers to work within a, one would have to use “” wrappers. Would it be possible to allow the math parser to read multi-number variable defined in the gmic interpreter?

Also, brings me a idea. is hex2vec a thing?

EDIT:

Got the hex2vec thing to work.

rep_hex2vec:

1,1,1,3,"begin(
  from_char(a)=a>=48&&a<=57?a-48:a-87;
  
  hex2vec(a)=(
   v=('$1');
   const vs=size(v);
   const m=int(vs/2);
   nv=vectorm(0);
   repeat(m,p,
    nv[p]=from_char(v[2*p])*16+from_char(v[2*p+1]);
   );
   nv;
  );
  
  hex_a=hex2vec($1);
 );
 hex_a[c];"