1 <!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
4 <meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8">
5 <meta http-equiv=
"Content-Style-Type" content=
"text/css">
7 <meta name=
"Generator" content=
"Cocoa HTML Writer">
8 <meta name=
"CocoaVersion" content=
"949.43">
9 <style type=
"text/css">
10 p
.p1
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
}
11 p
.p2
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; min-height: 14.0px}
12 p
.p3
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #bf0000}
13 p
.p4
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #000000}
14 p
.p5
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #9d1c12; min-height: 12.0px}
15 p
.p6
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; color: #0024f8}
16 p
.p7
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; color: #000000; min-height: 14.0px}
17 span
.s1
{font: 18.0px Helvetica
}
18 span
.s2
{color: #000000}
19 span
.s3
{color: #bf0000}
20 span
.s4
{font: 12.0px Helvetica
; color: #0024f8}
21 span
.s5
{font: 12.0px Helvetica
; color: #0000ff}
22 span
.s6
{color: #0000bf}
23 span
.s7
{color: #007300}
24 span
.Apple-tab-span
{white-space:pre
}
28 <p class=
"p1"><span class=
"s1"><b>NAryOpFunction
<span class=
"Apple-tab-span"> </span></b></span><b>represent a n-ary oparation on a function
</b></p>
29 <p class=
"p2"><br></p>
30 <p class=
"p1"><b>superclass: AbstractFunction
</b></p>
31 <p class=
"p2"><br></p>
32 <p class=
"p1">Operating on functions instead of numbers, what results is not a result of the calculation, but a structure that represents that calculation.
</p>
33 <p class=
"p2"><br></p>
34 <p class=
"p3">// example
</p>
35 <p class=
"p3"><span class=
"s2">a =
0.8.linexp(
0,
1,
40,
20000);
</span>// map (
0.
.1) to exponentially to human frequency hearing range
</p>
36 <p class=
"p4">a = { b }.linexp(
0,
1,
40,
20000);
<span class=
"s3">// result is
<span class=
"Apple-converted-space"> </span>a NAryOpFunction
</span></p>
37 <p class=
"p4">b =
0.1;
</p>
38 <p class=
"p3"><span class=
"s2">a.value;
</span>// now it is evaluated, and the result is calculated
</p>
39 <p class=
"p4">b =
0.5;
</p>
40 <p class=
"p3"><span class=
"s2">a.value;
</span>// again, with a different value.
</p>
41 <p class=
"p5"><br></p>
42 <p class=
"p6"><span class=
"s2">see also:
<a href=
"BinaryOpFunction.html"><span class=
"s4">BinaryOpFunction
</span></a>,
<a href=
"UnaryOpFunction.html"><span class=
"s4">UnaryOpFunction
</span></a></span></p>
43 <p class=
"p6"><span class=
"s2">related:
<a href=
"../Streams-Patterns-Events/NAryOpStream.html"><span class=
"s4">NAryOpStream
</span></a>,
<a href=
"../Streams-Patterns-Events/Patterns/Pnaryop.html"><span class=
"s5">Pnaryop
</span></a></span></p>
44 <p class=
"p2"><br></p>
45 <p class=
"p7"><br></p>
46 <p class=
"p3">// sound example
</p>
48 <p class=
"p4"><span class=
"s6">var
</span> a = {
1.0.rand };
</p>
49 <p class=
"p4"><span class=
"s6">var
</span> b = a.linexp(
0,
1,
40,
20000);
</p>
50 <p class=
"p4">fork {
</p>
51 <p class=
"p4"><span class=
"Apple-tab-span"> </span>15.do {
</p>
52 <p class=
"p4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(instrument:
<span class=
"s7">\default
</span>, freq: b.value).play;
</p>
53 <p class=
"p4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>0.3.wait;
</p>
54 <p class=
"p4"><span class=
"Apple-tab-span"> </span>}
</p>