PLnaryFunc dynamic scope Pnaryop variant for Functions
Part of: miSCellaneous
Inherits from: Pnaryop
Takes Symbol args for later reference by the Streams, which will read from variables in the Environments of their instantiation. See PLx suite.
See also:, Pnaryop, PLnaryop, Event patterns and Functions, VarGui, VarGui shortcut builds
Creation / Class Methods
*new (func, pat, arglist, envir)
Creates a new PLnaryFunc object.
func - Symbol or func arg.
If a Symbol is passed, func can be assigned to an envir variable later on.
Can be dynamically replaced by a Pattern or Stream.
pat - Symbol or pattern arg.
If a Symbol is passed, pattern can be assigned to an envir variable later on.
Can be dynamically replaced by a Pattern or Stream.
arglist - Symbols or arglist args.
They are starting with input for the Function's second arg,
as items from pat will be passed to its first.
If Symbols are passed, arglist args can be assigned to envir variables later on.
Can be dynamically replaced by Patterns or Streams.
envir - Dictionary or one of the Symbols
\top, \t (topEnvironment), \current, \c (currentEnvironment).
Dictionary to be taken for variable reference. Defaults to \current.
Examples
(
s = Server.local;
Server.default = s;
s.boot;
)
// definition for future reference in arbitrary Environments
(
p = Pbind(
\midinote, PLnaryFunc(\f, \src, [\dev]),
\dur, 0.1
);
)
// define Environment and play
(
e = (f: { |x,y| x + y }, src: PLseq([61, 62]), dev: Pbrown(-5, 5, 0.2) );
e.use { x = p.play };
)
// replace Function input Patterns
e.dev = PLseq((0, 0.5..7));
e.src = PLseq([61,64,65]);
// replace Function
e.f = { |x,y| x - y };
e.f = { |x,y| y * 4 + x };
x.stop;
See also PLx suite Ex. 5b.