sclang: ServerShmInterface - try to avoid multiple destructor calls
[supercollider.git] / HelpSource / Classes / UnaryOpFunction.schelp
blobcf8308a8ca80b0767ec30cffca1899fb41e9ac10
1 class::UnaryOpFunction
2 summary::represent a unary oparation on a function
3 related:: Classes/UnaryOpStream, Classes/Punop, Classes/BinaryOpFunction, Classes/NAryOpFunction
4 categories::Core
6 description::
7 Operating on functions instead of numbers, what results is not a result of the calculation, but a structure that represents that calculation.
9 examples::
11 code::
12 a = 2.sqrt; // result is square root of two (approximate floating point).
13 a = { b }.sqrt; // result is  a UnaryOpFunction
14 b = 2;
15 a.value; // now it is evaluated, and the result is calculated
16 b = 9;
17 a.value; // again, with a different value.
20 code::
21 // sound example
23 var a = { 19.rand };
24 var b = a.sqrt;
25 fork {
26         15.do {
27                 (instrument: \default, note: [a.value, b.value]).play;
28                 0.3.wait;
29         }