OpenMusic

Visual Programming | Computer-Assisted Composition

OpenMusic Reference

Prev| | Next


onlistloop

onlistloop

(control module) -- Enumerates consecutive groups of the elements of a list within omloop

Syntax

onlistloop list &optional by

Inputs

name data type(s) comments
list a list or tree  
by a function name or lambda function  

Output

output| data type(s)| comments
—|—|—
first| any| returns the cdr of list , then the cddr, then the cdddr, etc.

Description

Note

onlistloop is part of a group of functions for performing iterative loops. They can only be used within an omloop patch window. Since they only function within the context of the entire repeating loop, they (or any function connected to them) cannot be evaluated directly within the patch window. You must evaluate the entire loop. See the entry on omloop for more information.

—|—

onlistloop functions almost exactly like listloop . Instead of individual elements of the list, however, onlistloop performs cdr on list , then cddr, and so on, recursively. Thus, it first returns the whole list, then the list minus its first element, then the list minus the first two elements, etc., until the list is exhausted.

Examples

A simple onlistloop example

This demonstrates how onlistloop steps through progressively smaller cdrs of list

onlistloop passes a progressively smaller chunk of list each time, and the sublists are collected into a list by collect :

? OM->((1 2 3 4 5) (2 3 4 5) (3 4 5) (4 5) (5))


Prev Home Next
listloop Up counter (count)