( r = Routine { 5.do {|i| i.yield } } ) r.next; r.next; r.next; Array.fill(5, { |i| i }); // recursive lists z = [1, 2, 4, 3]; z[2] = z; // characters as elements of strings z = "wo?"; z[0]; z[0].class; // array operations on string z[1] = $e; z.reverse; z.scramble; // simple rewriting ( var t; t = "wo?"; f = { t = t ++ t.scramble; } ) f.value; // stream based rewriting ( r = Routine { var t; t = "wo?"; t.do { |char, i| char.yield }; t = t.scramble; t.do { |char, i| char.yield }; } ) r.next; // substring access "wertwert"[2..3] t = "wertwert"; t = t[0..3-1] ++ "lumig" ++ t[3+2..]; // a simple string rewriting system ( k = Routine { var t, index; t = "wo?"; t.do { |char, i| char.yield }; 5.do { t = t ++ t.scramble; index = t.find("wo"); if(index.notNil) { t = t[0..index-1] ++ "lumig" ++ t[index+2..]; }; t.do { |char, i| char.post.yield }; }; }; ) k.next; k.all.join; // a simple sonified string rewriting system ( k = Routine { var t, index; t = "wo?"; t.do { |char, i| char.yield }; 5.do { t = t ++ t.scramble; index = t.find("wo"); if(index.notNil) { t = t[0..index-1] ++ "lumig" ++ t[index+2..]; }; t.do { |char, i| char.post.yield }; }; }; k = k.collect { |char| char.ascii }; k = k.collect { |zahl| zahl % 15 }; ) s.boot; h = { |freq=440| Resonz.ar(PinkNoise.ar(10), freq.lag, 0.01) }.play; h.set(\freq, k.next * 200 + 100); // a routine as a sequenced player ( Routine { var z; loop { z = k.next; if(z.isNil) { nil.alwaysYield }; h.set(\freq, (z + 60).midicps); 0.1.yield; } }.play; )
(sc seminar, jrh)