/ valence analysis A:".abcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVXYZ" N:"0123456789" C:":" B:"[" V:(A;N;C;B) V,:,_ci(!256)_dvl _ic,/V state:{{.[x;(;y);:;z]}/[((#x),256)#-1;y;+x]} / A N C B X M:state[(1 0 0 0 0 2 2 3 0 0 2 2 3 0 0 1 0 4 0 0 1 0 0 5 0 1 0 0 0 0)]_ic V v:{[e] if["@"~*|e;:1] / monadic composition, e.g. f g h@ if[":"~*|e;:1] / monadic composition, e.g. *|: if[~"}"~*|e;:2] / dyadic composition, e.g. &/< if["["=*e:di 1_ e;:1++/";"=(e?"]")#e] / arg list t:type's:chop -1_ e r:?ds's@&t=1 v:?ds's@&t=2 u:(dd v)_dvl r +/|\(,:'"zyx")_in\:u} dq:{x@&~b|~=\~b:x="\""} / delete quotations dl:{x@&~k|0<':k:>/+\'x=/:"{}"} / delete lambdas db:{x _dvl" \t"} / delete blanks and tabs ds:{x@&x _lin A,N} / delete symbols di:{((x=" ")?0)_ x} / delete initial blanks dd:{x@&~"."=*:'x} / remove dotted names fsm:{cut[x;1_0 M\_ic x]} / finite state machine cut:{(&1=y i)_ x@:i:&y>0} chop:db'fsm dl dq@ type:{:[~x[0]_in A;0;|/b:_sm[x;*T];T[1;b?1];2]} T:(("*::[[]*";"*::*";"*:*");1 2 1) \ v[5:v] strip comments handle compositions ending with an adverb