OpenMusic

Visual Programming | Computer-Assisted Composition

OpenMusic Reference

Prev| | Next


list-explode

list-explode

(lists module) -- Divides list into nlists sublists of consecutive elements.

Syntax

list-explode list nlists

Inputs

name data type(s) comments
list a tree  
nlists a non-negativeinteger the number of sublists to produce

Output

output data type(s) comments
first a tree  

Description

list-explode attempts to subdivide list into nlists sublists of equal length. The lists will be of different lengths if list cannot be evenly divided by nlists .

If nlists exceeds the number of elements in list , the last element is repeated until nlists lists have been created.

Examples

Using list-explode

If (1 2 3 4 5 6 7 8 9) is passed as list and nlists is set to two, we get:

? OM->((1 2 3 4 5) (6 7 8 9))


Prev Home Next
list Up list-filter