Recherche Google
OpenMusic DocumentationOM 6.6 User Manual > Visual Programming II > Iterations: OMLoop > Iterators > OnList Loop
page précédentepage suivante

OnListLoop : Enumerating Subsets of Lists

General Properties

OnListLoop returns a list and then successive smaller chunks of the list. The execution ends once the list is exhausted.

Onlistloop has one default input and one optional input :

  • "list" : a list
  • "by" : a box defining the way the list is exhausted .

Controling Subsets Enumeration

"By"

The default value of "by" is a cdr. This means that, at each loop, the cdr of the list is returned.

This default value can be replaced by any other Lisp function meant to return a small chunk of list, just as listloop .

Examples

Here, onlistloop successively returns smaller chunks of the list, by taking away the first element of the list : it returns cdrs.

The result of each loop is collected by collect and returned by the second input of finally.

The value of "by" is switched to cddr. Onlistloop successively returns cdrs of cdrs : at each step, the two first elements of the list are left aside.

Note that the first input of finally always returns "nil" at the end of the loop.

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