Recherche Google
OM 6.5 – User ManualVisual Programming II > Higher-Order Functions > Lambda Patches
page précédentepage suivante

Lambda Mode Examples: Lambda Patches

Predefined functions on "lambda" mode may not always be adapted for higher-order processes. Patch boxes can also be set on "lambda" evaluation mode : they can represent more flexible functional arguments.

Any patch designed to process data can be used as a lambda function and perform its process in a higher-order function.

Example

This patch converts a frequency (Hz) in a midicent value and rounds it to the closest fraction of a tone expressed in midicents. Note that a tone represents 200 midicents.

  • The frequency value is assigned to the first input.

  • The fraction is defined in the second input.

In this case, 479Hz = 7048. This value is rounded to the closest 1/4 tone, that is, 200/4 = 50.

The same patch box can be used on lambda mode with mapcar in order to process a list of input values. Mapcar applies a function to the items of one or more lists, successively.

page précédentepage suivante
A propos...(c) Ircam - Centre PompidouRéalisé avec Scenari