I have worked on an algorithm to plot a dendrogram where the data are stored as a nested list. The final elements are strings (labels, if you want). But I encounter the problem that a string with two or more words cannot be distinguished from a listwith several elements. Is there a way to achieve this?
Here is a small example:
set a {"A B" C}
lindex $a 0 ==> A B
llength [lindex $a 0] ==> 2
set b {{"A B"} C}
lindex $b 0 ==> "A B"
llength [lindex $b 0] ==> 1
I can of course require labels of more than one word to be protected like in the second example. But is there a better solution?
Regards,
I have worked on an algorithm to plot a dendrogram where the data are stored as a nested list. The final elements are strings (labels, if you want). But I encounter the problem that a string with two or more words cannot be distinguished from a listwith several elements. Is there a way to achieve this?
I have worked on an algorithm to plot a dendrogram where the data are stored as a nested list. The final elements are strings (labels, if you want). But I encounter the problem that a string with two or more words cannot be distinguished from a listwith several elements. Is there a way to achieve this?
Here is a small example:
set a {"A B" C}
lindex $a 0 ==> A B
llength [lindex $a 0] ==> 2
set b {{"A B"} C}
lindex $b 0 ==> "A B"
llength [lindex $b 0] ==> 1
I can of course require labels of more than one word to be protected like in the second example. But is there a better solution?
Regards,
I have worked on an algorithm to plot a dendrogram where the data are stored as a nested list. The final elements are strings (labels, if you want). But I encounter the problem that a string with two or more words cannot be distinguished from a listwith several elements. Is there a way to achieve this?
Here is a small example:...
set a {"A B" C}
set b {{"A B"} C}
On 4/17/2023 5:00 AM, Arjen Markus wrote:with several elements. Is there a way to achieve this?
I have worked on an algorithm to plot a dendrogram where the data are stored as a nested list. The final elements are strings (labels, if you want). But I encounter the problem that a string with two or more words cannot be distinguished from a list
Here is a small example:
set a {"A B" C}...
set b {{"A B"} C}What does the full structure look like for a complete example?
Nothing spectacular, but the sort of presentation I have in mind is often seen to represent the result of clustering. Something like https://en.wikipedia.org/wiki/Dendrogram#/media/File:Global-Diversity-of-Sponges-(Porifera)-pone.0035105.s008.tif
You are slowly reinventing Tcllib's huddle: https://wiki.tcl-lang.org/page/huddle
On 4/17/2023 2:12 PM, Arjen Markus wrote:
Nothing spectacular, but the sort of presentation I have in mind is
often seen to represent the result of clustering. Something like
https://en.wikipedia.org/wiki/Dendrogram#/media/File:Global-Diversity-of-Sponges-(Porifera)-pone.0035105.s008.tif
Thanks for that, though I am still not clear :-) As already suggested,
you may need to tag your data. I would offer the following more generic structure:
% set my_dglist [list "root-label" $item1 $item2 $item3 ...]
where an item is as one or the other of:
[list "leaf" "Label1" more-details...] ## fixed-length of details
[list "combo" $item4 $item5 $item6 ...] ## any number of items
On 4/17/2023 4:42 PM, Rich wrote:
You are slowly reinventing Tcllib's huddle:
https://wiki.tcl-lang.org/page/huddle
It is funny you should say that :-) Just last week, I worked on parsing
some yaml files - and by extension, the huddle system. I didn't want to distract from the original post's subject by mentioning it.
But you are right: the structure is quite common and is easy to use.
The node deciders could be generic like in my post or they could be data types like in huddle.
saitology9 wrote:
On 4/17/2023 4:42 PM, Rich wrote:
You are slowly reinventing Tcllib's huddle:
https://wiki.tcl-lang.org/page/huddle
It is funny you should say that :-) Just last week, I worked on parsing some yaml files - and by extension, the huddle system. I didn't want to distract from the original post's subject by mentioning it.
But you are right: the structure is quite common and is easy to use.Yes, and for generic strings is is not possible to tell, from the
The node deciders could be generic like in my post or they could be data types like in huddle.
characters themselves, whether the string represents a string, a list,
or a dict. Extra "out of band" data has to exist somewhere (in code or
in the data) to indicate whether:
the quick brown fox jumped over
Is a simple string, a list of six elements, or a dict with three keys.
| Sysop: | Keyop |
|---|---|
| Location: | Huddersfield, West Yorkshire, UK |
| Users: | 715 |
| Nodes: | 16 (3 / 13) |
| Uptime: | 143:09:32 |
| Calls: | 12,089 |
| Calls today: | 2 |
| Files: | 14,998 |
| Messages: | 6,517,457 |