Hi!
applyintree =: 2 : 0
i =. >^:((1=#)@>) {. n
(u`(u applyintree (}.n))@.(1<#n)&.:> i{y) i} y
:
i =. >^:((1=#)@>) {. n
((x&u)`(x&(u applyintree (}.n)))@.(1<#n)&.:> i{y) i} y
)
This version support all previous features (except double boxing indices)
and working with unsupported structures for previous version.
] y =: ((<1) ,<2) ,: (<<'abc'), <'bb'
┌─────┬──┐
│1 │2 │
├─────┼──┤
│┌───┐│bb│
││abc││ │
│└───┘│ │
└─────┴──┘
(6 [ ]) applyintree(<1 1) y
┌─────┬─┐
│1 │2│
├─────┼─┤
│┌───┐│6│
││abc││ │
│└───┘│ │
└─────┴─┘
(6 [ ]) applyintree(1 0; 0) y
┌───┬──┐
│1 │2 │
├───┼──┤
│┌─┐│bb│
││6││ │
│└─┘│ │
└───┴──┘
Details for appleintree verb:
https://code.jsoftware.com/wiki/Vocabulary/AmendingBoxedStructures
Nice day!
Sergey
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm