A list is an ordered collection of scalars. Space for lists are dynamically allocated and removed from the program's memory. Each element can be addressed by its integer position in the list. Lists are 0-indexed; the first element is called "0". Typical operators include
$biggestInstrument = ("violin","viola","cello","bass")[3]; print("orchestral brass: ", join(" ",("trumpet","horn","trombone","euphonium","tuba")[0,1,2,4]), "\n");
Some list functions | |
---|---|
sort(LIST) | return a new list, the sorted from LIST |
reverse(LIST) | return a new list, the reverse of LIST |
join(EXPR,LIST) | return a string formed by concatenating each element of LIST joined by EXPR |
split(PATTERN,EXPR) | return a list formed from each substring of EXPR bordered by PATTERN. |
The National Center for Supercomputing Applications
University of Illinois at Urbana-Champaign
johnsonb@ncsa.uiuc.edu
Last modified: June 19, 1997