class library: Reset has been renamed to OnError
[supercollider.git] / SCClassLibrary / JITLib / Patterns / OpFunctionProxy.sc
blob25db1f68ad5b0b2bd554ddeb668e8430bd884390
1 UnaryOpFunctionProxy : UnaryOpFunction {
3         valueFuncProxy { arg args;
4                 ^this.reduceFuncProxy(args)
5         }
6         reduceFuncProxy { arg args;
7                 ^a.reduceFuncProxy(args).perform(selector)
8         }
9         value { arg ... args;
10                         ^this.reduceFuncProxy(args)
11         }
12         valueArray { arg args;
13                         ^this.reduceFuncProxy(args)
14         }
17         composeUnaryOp { arg aSelector;
18                 ^UnaryOpFunctionProxy.new(aSelector, this)
19         }
20         composeBinaryOp { arg aSelector, something, adverb;
21                 ^BinaryOpFunctionProxy.new(aSelector, this, something, adverb);
22         }
23         reverseComposeBinaryOp { arg aSelector, something, adverb;
24                 ^BinaryOpFunctionProxy.new(aSelector, something, this, adverb);
25         }
26         composeNAryOp { arg aSelector, anArgList;
27                 ^NAryOpFunctionProxy.new(aSelector, this, anArgList)
28         }
30         // behave like a pattern
31         embedInStream { arg inval;
32                 ^this.value.embedInStream(inval)
33         }
38 BinaryOpFunctionProxy : BinaryOpFunction {
40         valueFuncProxy { arg args;
41                 ^this.reduceFuncProxy(args)
42         }
43         reduceFuncProxy { arg args;
44                 ^a.reduceFuncProxy(args)
45                         .perform(selector, b.reduceFuncProxy(args), adverb)
46         }
47         value { arg ... args;
48                         ^this.reduceFuncProxy(args)
49         }
50         valueArray { arg args;
51                         ^this.reduceFuncProxy(args)
52         }
55         composeUnaryOp { arg aSelector;
56                 ^UnaryOpFunctionProxy.new(aSelector, this)
57         }
58         composeBinaryOp { arg aSelector, something, adverb;
59                 ^BinaryOpFunctionProxy.new(aSelector, this, something, adverb);
60         }
61         reverseComposeBinaryOp { arg aSelector, something, adverb;
62                 ^BinaryOpFunctionProxy.new(aSelector, something, this, adverb);
63         }
64         composeNAryOp { arg aSelector, anArgList;
65                 ^NAryOpFunctionProxy.new(aSelector, this, anArgList)
66         }
68         // behave like a pattern
69         embedInStream { arg inval;
70                 ^this.value.embedInStream(inval)
71         }
74 NAryOpFunctionProxy : NAryOpFunction {
76         reduceFuncProxy { arg args;
77                 ^a.reduceFuncProxy(args).performList(selector, arglist.collect(_.reduceFuncProxy(args)))
78         }
79         valueFuncProxy { arg args;
80                 ^this.reduceFuncProxy(args)
81         }
82         value { arg ... args;
83                         ^this.reduceFuncProxy(args)
84         }
85         valueArray { arg args;
86                         ^this.reduceFuncProxy(args)
87         }
90         composeUnaryOp { arg aSelector;
91                 ^UnaryOpFunctionProxy.new(aSelector, this)
92         }
93         composeBinaryOp { arg aSelector, something, adverb;
94                 ^BinaryOpFunctionProxy.new(aSelector, this, something, adverb);
95         }
96         reverseComposeBinaryOp { arg aSelector, something, adverb;
97                 ^BinaryOpFunctionProxy.new(aSelector, something, this, adverb);
98         }
99         composeNAryOp { arg aSelector, anArgList;
100                 ^NAryOpFunctionProxy.new(aSelector, this, anArgList)
101         }
103         // behave like a pattern
104         embedInStream { arg inval;
105                 ^this.value.embedInStream(inval)
106         }
110 // maybe make it an abstract function object.
111 NAryValueProxy : NAryOpFunctionProxy {
112         *new { arg receiver, args;
113                 ^super.new(nil, receiver, args ? [])
114         }
115         reduceFuncProxy { arg args;
116                 ^a.reduceFuncProxy(arglist.collect(_.reduceFuncProxy(args)))
117         }
118         storeOn { arg stream;
119                 stream << "o(" <<< a << "," <<<* arglist << ")" // is it always so?
120         }