I think the following example from the tutorial is incorrect: There is nothing that prevents the list ‘a’ to be shuffled prior it gets printed from the sorted live_loop. As a matter of fact, if you change the sleep time for shuffled to be more aggressive (e.g 0.1), you will observe this behavior.
## An Example of Deterministic Behaviour ## (despite concurrent access of shared state) ## using Sonic Pi's new Time State system. ## ## When this code is executed, the list that's ## printed is always sorted! set :a, (ring 6, 5, 4, 3, 2, 1) live_loop :shuffled do set :a, get[:a].shuffle sleep 0.5 end live_loop :sorted do set :a, get[:a].sort sleep 0.5 puts "sorted: ", get[:a] end