Hey, i have three arrays as the result of some functions (two nested ones) and would like to put them into a dictionary consecutively and order them by size. But im always rewriting with ~high_abs. The result should be 0-> [8], 1 → [3,5], 2 → [3,3,2], 3 → [3,1,2,2], 4 → [ 2,1,1,2,2 ], 5 → [ 2,1,1,1,1,2 ], 6 → [1,1,1,1,1,1,2], 7 → [1,1,1,1,1,1,1,1]
simplified code here:
(
//create Dictionary for abstractions
~absDict = Dictionary.new;
~lsys = #[3,1,2,2];
//add L-System
~absDict.put(0, ~lsys);
//add abstractions with lower density to the dictionary
~low_abs = [[ 3, 3, 2 ], [ 3, 5 ], [ 8 ]];
~low_abs.do({
arg el, elindex;
~absDict.put((elindex+1), el);
});
//add abstractions with higher density to the dictionary
~high_abs = [[ 2, 1, 1, 2, 2 ], [ 2, 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 1, 1, 1, 1 ]];
~high_abs.do({
arg el, elindex;
~absDict.put((elindex+1), el);
});
//get Dictionary in Order array.size low -> high
~absDict = ~absDict.atAll(~absDict.order.reverse);
~absDict.debug("abs dict");
)