// tcK - 1 stack / verbs k:,/+{.:'(x,":";x)}'"~!@#\$%^&*_-+=|:<,>.?" / F1,F2 = (~:;!:;..;~;!;..) v:-&0 20 20 / valences n:{[n;f]{f[(-n)_ x].(-n)#x}} / n-ary application / stack operators dup:n[1]{x,(y;y)} / X -> X X cons:n[2]{x,,(,y),z} / X [..] -> [X ..] swap:n[2]{x,(z;y)} / X Y -> Y X / combinators i:n[1]{E[x;y]} / [..] -> .. dip:n[2]{E[x;z,,y]} / X Y [P] -> X P Y linrec:n[4]{[x;i;t;e;f]:[E_[x;i];E[x;t];E[_f[E[x;e];i;t;e;f];f]]} / t if i else: e, recurse, f cond:n[1]{i:0;do[-1+#y;if[E_[x;y[i;0]];:E[x;y[i;1]]];i+:1];E[x;y i]} / [.. [X Y] .. Z] -> Y if X else Z / adverbs (k combinators) right:n[3]{[x;a;b;p]x,,a{*e(y;z),x}[p]/:b} / X Y f2 -> X f2/:Y over:n[2]{x,,{*e(y;z),x}[z]/y} / X f2 -> f2/X converge:n[2]{x,,{*e(,y),x}[z]/y} / X f1 -> f1/X / apply a:{:[~#y;(x;y);(4:*y)_in 4 7;(f[x;*y];1_ y);(x,1#y;1_ y)]} / apply if program-stack not empty f:{:[(#k)>i:k?y;(v[i]_ x),,y . v[i]#x;y x]} / apply k or tck0 program / eval E:{*(a .)/(x;y)} / evaluate y on x E_:{*-1#E[x;y]} / last of evaluate y on x e:E[()] / evaluate y on () / trace T:{(a .)\(x;y)} / trace evaluation of y on x t:T[()] / trace evaluation of y on () / define program P:d[(..)] (metalinguistic) d:{E[y;x]} / evaluate x on y