MY TREE REPRESENTION OF y IN ORIGINAL POST WAS WRONG.

As Raul's requests for examples finally showed me, there is nothing like a 
clear 
and correct problem statement.  We can represent the array

    ]A =: 2 2 3 $ 'abcdefghijkl'
abc
def

ghi
jkl

by the tree display

                A
        ________.________
       |                 |
    ___.___           ___.___
   |       |         |       |
  _._     _._       _._     _._
| | |   | | |     | | |   | | |
a b c   d e f     g h i   j k l


in which each '.' points to items of an array, and we think of the items as 
themselves arrays which can have items until we reach atoms which cannot have 
items (and I have used a for atom 'a', etc).

A box, B , is an atom and cannot have items.  It does have an open >B which can 
be either another box or an array.  I shall use

o        o
|   and  |  for the respective cases.  An 'o' does not point to an item,
o        .

it points to the open of a box.


Let us now deal with array y from the L: Level At page in the Dictionary.

    ]y=: (<<2 3 4),<(5 6 ; <<i. 2 3)
+-------+-------------+
|+-----+|+---+-------+|
||2 3 4|||5 6|+-----+||
|+-----+||   ||0 1 2|||
|       ||   ||3 4 5|||
|       ||   |+-----+||
|       |+---+-------+|
+-------+-------------+

              y
    __________.______________
   |                         |
   o                         o
   |                         |
   o               __________.___________
   |              |                      |
2 3 4            o                      o
                  |                      |
                 5 6                     o
                                         |
                                       0 1 2
                                       3 4 5

in which I have treated the final open arrays as atoms, but could have 
continued 
with their tree representations.  It is this kind of tree display that I would 
like the prospective verb boxtree to produce.

(I hope I have it right now, I am going to post and run to a meeting.)


Kip Murray wrote:
> Here is an array from the L: Level At page in the Dictionary.  Below is a 
> tree 
> display representing the array and showing levels (square brackets) and 
> leaves.
> 
> Your mission, should you decide to accept it, is to write a verb boxtree such 
> that "boxtree array" produces as much of the tree display as is practical.
> 
> To begin with, just produce the bare tree.  Each 'o' represents a box.  We 
> can 
> work on adding level markers, leaves, and the name of the array later.
> 
> I hope the array and tree display well in your email reader.  I sent them in 
> Unicode Courier New as defined by Microsoft's WordPad and transformed by 
> Thunderbird (email program).
> 
> Kip
> 
>       ] y=: (<<2 3 4),<(5 6 ; <<i. 2 3)
> +-------+-------------+
> |+-----+|+---+-------+|
> ||2 3 4|||5 6|+-----+||
> |+-----+||   ||0 1 2|||
> |       ||   ||3 4 5|||
> |       ||   |+-----+||
> |       |+---+-------+|
> +-------+-------------+
> 
> 
>                      y
>                      .  [3]
>                     / \
>                    /   \
>                   /     \
>                  /       \
>                 /         \
>                /           \
>               /             \
>          [1] o               o  [2]
>              |              / \
>              |             /   \
>              |            /     \
>              |           /       \
>          [0] o      [0] o         o  [1]
>            2 3 4       5 6        |
>                                   |
>                                   |
>                                   o  [0]
>                                 0 1 2
>                                 3 4 5
> 
> 
> 
> 
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to