Talk:Tree datastructures: Difference between revisions
(And when comparison has children?) |
|||
Line 35: | Line 35: | ||
==And when comparison has children?== |
==And when comparison has children?== |
||
--[[User:Nigel Galloway|Nigel Galloway]] ([[User talk:Nigel Galloway|talk]]) 13:03, 16 October 2019 (UTC) |
--[[User:Nigel Galloway|Nigel Galloway]] ([[User talk:Nigel Galloway|talk]]) 13:03, 16 October 2019 (UTC) |
||
Depends, of course, on the implementation of equality in each. For JS I have had to hand-write a recursive '''eq'''. Haskell Data.Tree includes an instance for the Eq class. Python's (==) equality is recursive out of the box. [[User:Hout|Hout]] ([[User talk:Hout|talk]]) 13:27, 16 October 2019 (UTC) |
Revision as of 13:27, 16 October 2019
Good idea for a task – a couple of thoughts.
This seems a promising kind of task – perhaps worth linking to the Functional Coverage Tree task, so that the latter can use outline parsing routines shaped up here.
A couple of thoughts:
- Perhaps JSON serialisations, both for the nested and numbered data types ?
- Unicode characters beyond the narrowly Anglo-Saxon alphabet ? Hout (talk) 23:09, 15 October 2019 (UTC)
The simplest nested JSON output (each node a value+list pair) would be:
[["RosettaCode",[ ["rocks",[ ["code",[]], ["comparison",[]], ["wiki",[]] ]], ["mocks",[ ["golfing",[]] ]] ]]]
Hout (talk) 23:43, 15 October 2019 (UTC)
Incidentally, do you feel strongly committed to that particular outline ? For some reason the word 'mock' jars a little (perhaps particularly now that we are beginning to understand more about the destructive potential of digital networks). Hout (talk) 23:43, 15 October 2019 (UTC)
Similarly, the simplest JSON output list for integer+value tuples would be:
[[0,"RosettaCode"], [1,"rocks"], [2,"code"], [2,"comparison"], [2,"wiki"], [1,"mocks"], [2,"golfing"]]
Hout (talk) 23:46, 15 October 2019 (UTC)
And when comparison has children?
--Nigel Galloway (talk) 13:03, 16 October 2019 (UTC)
Depends, of course, on the implementation of equality in each. For JS I have had to hand-write a recursive eq. Haskell Data.Tree includes an instance for the Eq class. Python's (==) equality is recursive out of the box. Hout (talk) 13:27, 16 October 2019 (UTC)