r/ProgrammingLanguages • u/Athas Futhark • Jun 18 '26
Data parallel pretty-printing
https://futhark-lang.org/blog/2026-06-18-data-parallel-pretty-printing.html
16
Upvotes
r/ProgrammingLanguages • u/Athas Futhark • Jun 18 '26
View all comments
Show parent comment
3
u/Athas Futhark Jun 18 '26 edited Jun 18 '26
Having the root as the first element is a convention to make the code in the blog post simpler. If you have a richer datatype, it's no big deal to track explicitly which node is the root, and if you have a parent vector representation it is also straightforward to find it with a search - that is actually what the library
euler_tourfunction does.The representation of the tree in the post was explicitly written in a slightly odd order to demonstrate that we do not expect the nodes to be stored in any particular order (actually, the
mk_Pfunction does assume ordering within each level in the tree, which I didn't want to go into...).