Late to the party - I had a look at the problem after the correspondence
closed, and have only
just got home to my own wifi.
I developed a few functions, tpxxxmd, not pretty in themselves, which
attempt a number of variations,
some using box characters, 19 22 25 26 { a.
Unfortunately, I noticed that Raul's one-liner can show some vertical
connectors which aren't there.
"xash's" function is ok for the same example:
(tpmd; tplbmd; tpboxmd; tpboxmdb; pt; raul) 0 1 2 3 3 1 NB. display
is ok at send time!
+-------+-------+-------+----+-------+--------+
|o |o |o |o |o |-o |
||-o |+-o |├─o |├o ||-o | |-o |
|| |-o || +-o |│ └─o |│└o || +-o | | +-o |
|| |-o|| +-o|│ ├─o|│ ├o|| |-o| | | |-o|
|| |-o|| +-o|│ └─o|│ └o|| +-o| | + +-o|
||-o |+-o |└─o |└o |+-o | +-o |
| | | | | | |
+-------+-------+-------+----+-------+--------+
tplbmd (lb = "elbow"!) renders all bends/elbows as "+" which seems
reasonable, but perhaps
it is better to stick to "|" when there are further daughters at that
level, as Raul and xash do.
Anyway, I did distinguish these cases with the box character versions.
Cheers,
Mike
On 07/08/2020 23:21, Raul Miller wrote:
Alternative (slightly more compact) implementation of tv:
tv=: (0 = {.) *./@, (0 < {:), 1 >: +/\inv
Meanwhile, this is probably a bit long (almost 100 characters) to be
called a one line implementation, but it seems to be in the right
ballpark:
;"1(' - ',&.>' o+|'){~(+3*_1 1&E.)"1&.|:(*
./\.@:*)0,~2:`(}.@((i:,.]-1:) ~.))`((1,~]#_1:)"0)}~d
-o
|-o
| |-o
| +-o
|-o
+-o
|-o
+-o
+-o
I hope this helps,
--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm