infix: string x integer x integer -> string
infix: list x integer x integer -> list
infix: sequence x integer x integer -> sequence
infix: string x integer -> string
infix: list x integer -> list
infix: sequence x integer -> sequence
infix(s, int_1, int_2)
s( int_1, int_2)
infix returns the a fragment of a serial object (string, list, or sequence) starting at index position int_1 with length int_2. Length is measured in characters for strings, in list-elements for lists, and in notes for sequences; the index positions within serial objects are counted 1,2,...,length(s).
The start position int_1 can be a negative value, in which case it is counted from the end of the series (with index position -1 corresponding to length(s)). If the length int_2 is specified as a negative value, int_1 denotes the right end of the subsequence to be extracted (see examples).
infix also accepts length values int_2 exeeding the last (or the first) position of series s. In this case, the length is interpreted as if it just reached the beginning (or end) of s (see examples).
The length specification int_2 can be ommited, in this case a length of one is assumed by default. As a shorthand notation, s(int_1,int_2 is equivalent to infix(s,int_1,int_2) and s(int) is equivalent to infix(s,int); this works only if s is the name of a serial object, not for constants or general expressions denoting serial objects.
For note sequences, infix should not be confused with the function fragm which is used to obtain a fragment specified by its relative time positions.
If called with an invalid start position int_1, infix returns the respective empty series as a result, while no error condition occurs.
> name := "A.Salieri";
> infix(name, 3,3)
> infix(name, 3,50)
> infix(name, 3,-3)
> infix(name, 3,-10)
> infix(name, 3,0)
See also: string (object type), list (object type), sequence (object type), length, fragm.