My Snap! skills have failed on me (again)
How can I transform from 1st to the 2nd one (in generic manner - this is just a sample)
[edit] each list isn’t necessarily the same length
i.e. rows can contain any number of lists but they are all simple ones - there is no further nesting
I think you can use the append block to add two lists (or even more together) without forming a nested list
Could post an example of using append to get from 1st structure to 2nd structure
bh
October 1, 2025, 4:17pm
7
Is the input always of rank 3? (a list of lists of lists of atoms) If so, you can just do this:
If the input can be of any rank, then use dardoro’s solution.
Yes - it’s always going to be rank 3 so your answer will work as well
But I’m struggling to see why your’s works Give me a few minutes to see if I can work it out for myself
[edit]
Of course, all I had to do was read how the block is coded using Snap! itself and all is now clear
jens
October 2, 2025, 2:38am
9
did you know that you can use reshape and if you leave dimensions blank (or enter zero) it will automatically fill them up to make it fit all the elements? This lets you easily and directly solve your issue like this:
It’s more like stripping leaves from the tree that are simple lists (with rank=1).
, rather than creating uniform bricks of wood
system
Closed
November 1, 2025, 9:54am
12
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.