Tree from nesting levels: Difference between revisions

m
(J: draft implementation)
Line 1,046:
Without any use cases for these trees, it's difficult to know if any implementation is correct.
 
Note here, that the notation used to describe these trees has some interesting consequences in the context of J:
Therefore, initially, we'll take the simplest implementation which satisfies an interpretation of the description of the task.
 
<lang J> [[[3]], 1, [[3]], 1
1 1
[[[3]], 1, [[3]], 1]
|syntax error</lang>
 
On a related note, there are type issues to consider -- in J's type system, a box (which is what we would use 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.
 
ThereforeBut, initially, we'll take the simplest implementation which satisfies an interpretation of the description of the task. might not be what was intended:
 
<lang J> <^:]each ''
6,962

edits