OpenMusic

Visual Programming | Computer-Assisted Composition

OpenMusic Reference

Prev| | Next


list-modulo

list-modulo

(lists module) -- Breaks a list down into sublists of elements at regular intervals

Syntax

list-modulo list ncol

Inputs

name data type(s) comments
list a tree  
ncol a non-negativeinteger the modulo for the grouping

Output

output data type(s) comments
first a tree  

Description

list-modulo breaks a list down into sublists of elements occuring every n th starting with the first, then starting with the second, etc., until all the elements of the master list have been used. n is specified by ncol

It is possible that the lists will be of unequal length if ncol does not divide evenly into list .

Examples

Using list-modulo

Starting with one, we get every 2nd element, so the first sublist is (1 3 5). The next starts at two: (2 4). The function finishes here, since all the elements have been used:

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


Prev Home Next
list-min Up mat-trans