TITLE:: Pget
summary:: Retrieve a value within the scope (namespace) of a Plambda
categories:: Streams-Patterns-Events>Patterns>Data Sharing
related:: Classes/Plambda, Classes/Plet

DESCRIPTION::
link::Classes/Pget:: retrieves the value of a link::Classes/Plet::. 
link::Classes/Plet::/link::Classes/Pget:: are used to share data between patterns inside of a link::Classes/Plambda::

CLASSMETHODS::

METHOD:: new

ARGUMENT:: key
The name of the variable

ARGUMENT:: default
default value if none is defined by a paired link::Classes/Plet::

ARGUMENT:: repeats

INSTANCEMETHODS::

METHOD:: default

METHOD:: storeArgs

METHOD:: key

METHOD:: repeats

METHOD:: embedInStream

ARGUMENT:: inval

EXAMPLES::

code::
(
	/*

	Two patterns playing in parallel, 
	sharing data between eachother

	*/

	// a melody playing random scale degrees
	a = Pbind(
		\dur, 0.125, 
		\octave, 4,
		\degree, Plet(\melody, pattern: Pwhite(0,7))
	);

	// the bass, scale degrees sampled from the \melody variable defined above 
	b = Pbind(
		\dur, 0.5, 
		\octave, 3,
		\degree, Pget(\melody, default: 1, repeats: inf).trace
	);

	// Play the patterns in parallel
	Plambda(
		Ppar([a, b], inf)
	).play;
)
::
