On 4/2/07, Pascal Jasmin <[EMAIL PROTECTED]> wrote:
I did consider your solution's output, but preferred the sample I provided.
(except that I mistakenly specified that body would be contained inside
head). The reason being that A cell contains all of its children. The
inconsistency in my sample is just that if a cell has only one member
(no children), then it can be raised to the top level. The key difference
between my spec and yours, is that the body node has 4 enclosed
members, and # would reflect that. Table has 1 member, and tr has 2.
I wanted the spec to let each cell know where it ends without looking at
its neighbours.
I think this means you need double boxing at each level.
On the one hand, you want the entirety of each level to be a single
atom.
On the other hand, you want each level to be represented as a
sequence of boxes. (And, I think these have to be boxes, in the
general case, because at this level of abstraction you are mixing
raw strings with the single atom boxes described above.)
This leaves me with something like:
blocks=: [: +/\ ' ' ~: {."1
nest=: <@<@{.`({. <@,&< (blocks $:/. ])@(}."[EMAIL PROTECTED]))@.({. <&('
'&[EMAIL PROTECTED]) {:)
nest [;._2 test
That said, if I instead use
nest2=: <@{.`({. <@,&< (blocks $:/. ])@(}."[EMAIL PROTECTED]))@.({. <&('
'&[EMAIL PROTECTED]) {:)
> nest2 [;._2 test
I get something rather like your original request (where the label is
boxed only for the case where it is accompanied by some indented
content).
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm