[Contents] · [Home] · [Mail]

SALIERI Language - del

Type:
del: string x integer x integer -> string
del: list x integer x integer -> list
del: sequence x integer x integer -> sequence
del: string x integer -> string
del: list x integer -> list
del: sequence x integer -> sequence

Call syntax:
del(s, int_1, int_2)
del(s, int)

Description:
del returns the serial object obtained from s (string, list, or sequence) by deleting the fragment 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).

del 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.

Error conditions:
If called with an invalid start position int_1, del causes an error condition to occur.

Example:
> name := "A.Salieri"
> piece := "piano concerto B major"
> del(piece, 15, 8)
Result="piano concerto"
> del(name, 2,-2)
Result="Salieri"
> del(name, -6,7)
Result="A.S"
> del(name, 2)
Result="ASalieri"
> del(piece, #piece+1, 1)
Error in command-line:
Wrong startposition
(occurred while executing function "del")

See also: string (object type), list (object type), sequence (object type), length, infix, ins.


[Contents] · [Home] · [Mail]
© sic!systems, page frame designed by hh; this page has been automatically generated from the SALIERI Documentation Database.