\k 1 a:((84 66;87 26 55);(20 6 11;(1 21 93 71;94 70;,18);42);1;(,8;85 44)) b:,//:a / ugly: use global state i:-1 f:{$[x~*x;i+:1;f'x]} k:f a c:b k / ngn: carry, amend, and return state h:{$[y~*y;x[1]+!2;(*'a;*|*|a:x h\:y)]} f:*h[0]@ l:f a d:b l c~d / ngn using one of john earnest's recursive combinators: r:{[p;f;d;c;x]$[p x;f x;c@r[p;f;d;c]'d x]} /recursive combinator A:{x~*x} /atom? n:r[A;1;:;+/] /deep count f:r[A;0;:;{x++\-1_0,n'x}] /enumerate raze order m:f a e:b m c~e \ you're given a highly nested list a. write two functions f and g. use f to compute the "structure" of a (whatever that is -- you design it), then use g to recreate a from b using k. to make the problem interesting (i.e. to guard against trivial solutions, like f:{x};g{y}), suppose a and b are: a:((84 66;87 26 55);(20 6 11;(1 21 93 71;94 70;,18);42);1;(,8;85 44)) b:^,//:a and the problem is to sort the elements of a, thus: k:f a c:g[b]k c ((1 1;6 8 11);(18 20 21;(26 42 44 55;66 70;,71);84);85;(,87;93 94)) / k3: f:{i::-1;{:[@x;i+:1;_f'x]}x}