Tree from nesting levels: Difference between revisions

m
Line 1,046:
Without any use cases for these trees, it's difficult to know if any implementation is correct.
 
NoteAs a side note here, that the notation used to describe these trees has some interesting consequences in the context of J:
 
<lang J> [[[3]], 1, [[3]], 1
Line 1,053:
|syntax error</lang>
 
OnBut, on a related note, there are type issues to consider -- in J's type system, a box (which is what we would use here to represent a tree node) cannot exist in a tuple with an integer. A box can, however, contain an integer. This makes a literal interpretation of the task somewhat... difficult. We might, hypothetically, say that we are working with boxes containing integers and that it's these boxes which must achieve a specific nesting level. (If we fail to make this distinction then we wind up with a constraint which forces some tree nodes to be structured different from what appears to be the task specification. Whether or not this is an important issue is difficult to determine without use cases. So, for now, let's assume that this is an important distinction.)
 
Anyways, here's an interpretation which might be close enough to the task description:
6,951

edits