OpenMusic Reference
subs-posn
subs-posn
(lists module) -- replaces select elements of a list
Syntax
subs-posn lis1 posn val
Inputs
name | data type(s) | comments |
---|---|---|
lis1 | a tree | the master list |
posn | a list of successiveintegers | the locations at which to place elements from val |
val | a tree | the list of replacement elements |
Output
output | data type(s) | comments |
---|---|---|
first | a tree |
Description
This module substitutes elements from lis1 at positions given in the list posn with values, taken in sequence, from val . subs-posn functions only at the first level of nesting; sublists in either lis1 or val are treated as single elements for purposes of the substitution.
If the requested position in posn does not exist in lis1 , the substitution will not be made and the corresponding element of val will be skipped.
![]() |
subs-posn will not function correctly if the integers in posn are not in ascending order
—|—
Examples
Replacing select elements of a list
Here, elements 1 and 3 of the list will be replaced with a and b :
? OM->(1 a 3 b)
Prev | Home | Next |
---|---|---|
sqrt | Up | sysex |