\d c compile:{[p]val[post]compile_ . p} compile_:{[v;e;w] r:com[v]val[pre]e if[~_n~w;r:where[r;!w]w[]] r:val[mid]r r::[#e;r;#r;r 2;r] r} where:{[e;s;w]what[e;s;(compile_ .)'w]} what:{[e;s;c]:[~#i:who[,//e;s;,//'c];e;@i;clause[e;s i]c i;clauses[e;s i]c i]} who:{[e;s;c]atom s?/:use[.+(s;c);s]/in[s]e} use:{[d;s;v]v{?x,in[s]d y}/v} in:{x@&x _lin y} atom:{:[1=#x;*x;x]} clause:{[e;s;c]:[s _in,//c;wy;wx][e;s]c} wx:{[e;s;c]({};abs[e]s;c)} wy:{[e;s;c]({};abs[e]s;({};"XY";abs[c]s))} clauses:{[e;s;c]:[|/s _lin,//c;wY;wX][e;s]c} wX:{[e;s;c]({};({};"XK";e)wU/|s;wL c)} wY:{[e;s;c]({};({};"XK";e)wU/|s;({};"XY";({};"XK";wL c)wU/|s))} wU:{[e;s]({};"XU";abs[e]s)} wL:{[e](){({};({};{`cons};y);x)}/|e} com:{[v;e]unk@:[#v;e abs/|v;abs[e]v]} unk:{[e]:[({};"XK")~2#e;e 2;e]} abs:{[e;v]:[{}~*e;exp;4=4:e;var;con][e]v} con:{[e;v]({};"XK";e)} var:{[e;v]:[v~e;"XI";({};"XK";e)]} exp:{[e;v]opt .(1_ e)abs\:v} sym:{atom`$1_'(&x="`")_ x} val:{[f;e]:[~4:e;_f[f]'e;-3=4:e;f[`$*e]1_ e;5=4:e;@[e;_n;_f[f]];e]} mid:{ :[x=`Z ;{} x=`Y ;{()} x=`j ;{0n} x=`J ;{0N} x=`k ;{0i} x=`K ;{0I} x=`E ;{{`eq}} x=`O ;{{`cond}} x=`C ;{{`cons}} x=`W ;({`head};{`tail})($`head`tail)? x _in`N`V`A ;.: x _in`S`Q`X ;($x), ::]y} pre:{:[x _in`I`L;`$;($x),]y} post:{:[x=`Q;. y;x=`S;sym y;x=`X;`$y;y]} O:1 opt:{ kx:O&({};"XK")~2#x ky:O&({};"XK")~2#y bx:O&:[{}~*x;({};"XB")~2#x 1;0] by:O&:[{}~*y;({};"XB")~2#y 1;0] iy:O&"XI"~y :[kx&ky ;{({};"XK";({};x 2;y 2))} / S(Kf)(Kg) -> K(fg) kx&iy ;{y;x 2} / S(Kf)I -> f kx&by ;{({};({};({};"XB*";x 2);y[1]2);y 2)} / S(Kf)(Bgh) -> B*fgh kx ;{({};({};"XB";x 2);y)} / S(Kf)g-> Bfg bx&ky ;{({};({};({};"XC'";x[1]2);x 2);y 2)} / S(Bfg)(Kh) -> C'fgh ky ;{({};({};"XC";x);y 2)} / Sf(Kg)-> Cfg bx ;{({};({};({};"XS'";x[1]2);x 2);y)} / S(Bfg)h -> S'fgh {({};({};"XS";x);y)}][x;y]} / Sfg \d ^ Compile:c.compile Value:c.val[c.post]c.val[c.mid]c.val[c.pre]@