Mixing associative with integer indexed arrays?
21 Nov
2008
21 Nov
'08
11:18 p.m.
Is it possible to mix both types of array keys? The code I below works fine until I try to access any elements of the array, then I get an ArrayOutofBounds exception. The snippet is pretty short and I would hope it's self evident what I'm trying do with it. float scales[0][0][0]; [ 0, 2, 4, 5, 7, 9, 11, 12 ] @=> melodies[0]; [ [1.0, 1.0], [16.0, 15.0], [9.0, 8.0], [6.0, 5.0], [5.0, 4.0], [4.0, 3.0], [7.0,5.0], [3.0, 2.0], [8.0,5.0], [5.0, 3.0], [7.0, 4.0], [15.0, 8.0], [2.0, 1.0] ] @=> scales["just"]; float et[13][2]; for(0 => int i; i <= 12; ++i){ 1.0 => et[i][0]; Math.pow(2.0, i / 12.0) => et[i][1]; } et @=> scales["equalTempered"]; <<< scales["just"][0] >>>;
5900
Age (days ago)
5900
Last active (days ago)
0 comments
1 participants
participants (1)
-
Stephen Sugden