You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
k/g.k

20 lines
911 B

#!k
r:("// ngn/k, (c) 2019-2022 ngn, license: GNU AGPLv3 - https://codeberg.org/ngn/k/raw/branch/master/LICENSE"
"// generated by g.k")
R:,/{$[x~"@";*y;x~"$";y 1;x~"%";_*y;x]}\:;d:{r,:"#define ",/:x[0]R/:+a@'!#'a:1_x;}
v:"xyzu";t:"ABHILFC";T:t,"SMmilfscopqruvwx";U:T,"UPRtTzZ",$`cC`lL`fF`sS`zZ`mM`mt`MT`zf`ZF`zc`ZC`zfc`ZFC`mMA`sSA
/@:arg[0],$:arg[1],%:lower(arg[0])
d("@$ _$(@)";v;"EKkmNnoRrtUVvWwXxyZz",t,(_t),"t",'U)
d("@$(a...) _$(@,a)";v;"qe128")
d("@$(a...) P(%t$,a)";"XYZ";U)
d("@(a) ({A r_=(a);mr(@);r_;})";v)
d("_@(x) ((@*)_V(x))";t)
d("_%(x) _@(x)[i]";t)
d("_t@(x) (_t(x)==t@)";"ABHILFCSMmlfopqr")
d("_t@(x) (_t0(x)==t@)";"iscuvwx")
d("N@(r) N(r,@(0))";v)
d("o@ _R(ce[t@])";"ABLFCS")
d'(,"@$ @ $"),/:":"\'" "\"C:bcdt ILN:ijkmn CBHILF:v I:f A:xyzu O:ACV Q:spq";
r,:{"#define _",x,"(x) ((A*)_V(x))[",y,"]"}'["xyz";"012"]
r,:{"#define _t",x,"(x) (_t",(-1_x),"(x)||_t",(-1#x),"(x))"}'(1<#:')#U
"g.h"0:r