It looks like you're new here. If you want to get involved, click one of these buttons!
output this?(set: $data to (a:1,2,3))
(set: $set to (dataset:))
(set:$set to it + (dataset:$data))
(print:$set's length)
(set:$set to it + (dataset:$data))
(print:$set's length)
(set: $choice to $data)
(set:$set to it + (dataset:$choice))
(print:$set's length)
(set:$set to it + (dataset:$choice))
(print:$set's length)
(set: $choice to $data)
(set:$set to it + (dataset:$choice))
(print:$set's length)
1
1
2
2
3
Comments
When you add items to a collection object like an Array (Datamap, Dataset) the result is a new object, and this causes an interesting side effect if the original object was referenced by more that one variable. The variable used in the modification will reference the new object where as the other variables will still reference the original object.
It is even more complex when you modify the contents of an element within a collection object, especially if the element is a collection object itself.
I have left the best till last, when the reader navigates from one passage to another the current state of all known variables is copied and it is this copy that is made available to the new passage. This means that all variables that referenced objects now reference new instances of those objects with a similar value, including any objects that those original objects referenced internally.
eg. the $data variable references a new Array object, $list references a new Array object, each element of $list references a new Array object, etc....