Arrays: Difference between revisions

No change in size ,  4 years ago
(Add LIL)
Line 3,701:
LIL, like Tcl, doesn't manage arrays as such. Indexed lists are used in LIL. The '''list''' command creates a list from the remaining arguments in the statement. The '''index LIST NUM''' command returns the NUM'th item in the list, starting from zero. Lists are copied on assignment. The array-ish functions and operators would be
 
-* index LIST NUM, returning the NUM'th item
-* count LIST, returning the number of items in the list
-* indexof LIST VAL, returning the offset from zero position of where VAL is found in LIST, or an empty string
-* filter VARNAME LIST EXPRESSION, returning a new list of filtered items matching EXPRESSION, with the value under test in VARNAME.
-* list ..., creating a list from remaining word tokens in the statement.
-* append LIST VAL (list VAL values are appended as single items to the given LIST)
-* slice LIST FROM-NUM TO-NUM
-* foreach VARNAME LIST CODE
-* charat STRING NUM, indexing a string for characters
-* codeat STRING NUM, indexing a string for the character byte code
-* lmap LIST VARNAME..., maps the list items to the given variable names, in the order given.
 
<lang tcl># Not Arrays in LIL
Anonymous user