Thanks everyone for the responses.  I have watched the APL video recently
but have not tried to convert Aaron's code to J.  However, the essay
suggested by Julian does what I want.
Bo's response is intriguing but I have not figured out how to convert my
tree representation to ordinal numbers.

On Mon, Jul 20, 2020 at 1:40 PM 'Bo Jacoby' via Programming <
[email protected]> wrote:

>  Minor simplification:
>
>       n=.(/:{])12 3$'000100200110120210220230211221222223'
>
>       (6-~+/"1 n='0')|."0 1 n,"1'00',(4#' '),'§'
>
>
>
> Thanks.
> Bo.
>     Den søndag den 19. juli 2020 23.49.17 CEST skrev 'Bo Jacoby' via
> Programming <[email protected]>:
>
>   I use ordinal fractions.
>
>
>
> nms=.'000';'100';'200';'110';'120';'210';'220';'230';'211';'221';'222';'223'
>
>
>
> The digits are ordinal numbers, 1, 2, 3, . . . rather than cardinal
> numbers 0, 1, 2, . . .
> The digit zero means everything rather than nothing.
>
>
>  nms=.'000','100','200','110','120','210','220','230','211','221','222',:'223'
>
>    nms=.(/:nms){nms NB. sort
>
>    (3-~+/"1 nms='0')|."0 1 nms,"1'   '
>
> 000
>
>  100
>
>   110
>
>   120
>
>  200
>
>   210
>
>    211
>
>   220
>
>    221
>
>    222
>
>    223
>
>   230
>
>
>
>
> This is not the J concept of array, but something else.
>
>     Den søndag den 19. juli 2020 22.13.08 CEST skrev Devon McCormick <
> [email protected]>:
>
>  Does anyone have a good way to display a tree in J?  EG
> C:
> |__n0
> |  |_n00
> |  |_n01
> |
> |__n1
>     |__n10
>     |  |__n100
>     |__n11
>     |  |__n110
>     |  |__n111
>     |  |__n112
>     |__n12
> for a tree in parent index form:
>     tr=.  _1    0    0    1      1    2    2    2      5      6      6
>     6
>   nms=.
> 'C:';'n0';'n1';'n00';'n01';'n10';'n11';'n12';'n100';'n110';'n111';'n112'
> Where "tr" is the parent-index form (with _1 for the root) and "nms" are
> the names of each node.
>
> Any other neat representation of a tree would also be appreciated.
>
> Thanks,
>
> Devon
>
> --
>
> Devon McCormick, CFA
>
> Quantitative Consultant
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

Quantitative Consultant
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to