Thunk:
Filter:
Classes | Core > Kernel

Thunk : AbstractFunction : Object

unevaluated value
Source: Function.sc
Subclasses: CallOnce, UGenThunk

Description

Thunk, "past tense of think", can be used when a calculation may, or may not have to be performed at a later point in time, and its value is needed several times. This is an example of lazy evaluation, and can be used to avoid unnecessary calculations and to make state immutable.

Class Methods

Thunk.new(function)

Arguments:

function

some function that returns the desired value

Inherited class methods

Instance Methods

.value

return the value. If calculation is done, use previous value, otherwise do calculation.

Inherited instance methods

Undocumented instance methods

.clear

.didEvaluate

.valueArray

.valueArrayEnvir

.valueEnvir

Examples