/ 0 cross1:+(,/,/:\:)/(),/: cross1(0 1 2;3 4;5 6 7 8) cross2:{x@'k _vs!*/k:#:'x} cross2(0 1 2;3 4;5 6 7 8) cross3:{x@'!#:'x} / uses ! "odometer", k4 or higher / 1 *|+6(|+\)\1 1 / 2 undict:{:[5=4:x;(!x;_f'x[]);x]} d:.+(`a`b;(.+(`c`d`e;10 20 30);.+(`f`g;(40;.+(`h`i`j;50 60 70))))) undict d / 3 wrap:{(b -1_(-1+b _binl x+b:0,1+&" "=y)\0)_ y,:" "} wrap[20;"Write a function 'wrap' which takes a width w and a string of words s and returns a list of strings which represent the world-wrap of s in w"] / 4 / ~:/0 / 5 s:.+(`a`b`c`d`e`f;(0#`;,`a;,`a;,`c;`b`d;,`e,`f)) dependson:{?,/{(!x)@&|/+y _lin/:x[]}[x]\y,()} dependson[s]`a dependson[s]`d / 6 a:10 20 30 40 50 b:10 40 20 30 50 c:10 30 40 20 50 d:10 20 40 30 50 e:50 10 20 30 40 moved:{d?|/d:_abs(x?/:y)-!#x} a moved/:(b;c;d;e) / 7 s:.+(`d`c`e`b`a;(`c`b;`b;`d`a;0#`;0#`)) reorder:{?|,/(?,/x@)\!x} order s / 8 p:0 0 1 1 0 4 5 5 5 / parents l:(!#p)_dvl p / leaves d:@[&#p;l;:;10*l] / data at leaves i:p\'!#p / paths from leaves to root s:@[&#p;i;+;d] / sum from leaves to root s / 9 g:.+(`a`b`e`f`g`h`i`j;(),/:(`b`e`h;`c`f;`d`g;`e`j;`f;`i;`h;`j)) / keys of loops asc:{x@) select:{[t;f;c]@[t;_n;@[;{x y z x}/[_n;c;t f]]]} select[t;f]c / 13 pad:{x,((0|-/s),*s:|^x)#0} squarify:2(+pad@)/ / 14 f:{x y z x} / multi-field sort s:{1_'(&x=".")_ x:".",x} / split string on . p:{,/x#,".0"} / pad string with .0 n:|0$+: / reverse cast flip k:{f/[_n;x;n y{s y,p x-z}[|/c]'c:+/'y="."]} / grade y with x u:k[<:];d:k[>:] / up/down / 15 ?????