List Functions

VOID list(LIST_V);

declare a list

BOOL empty(LIST);

check if list is empty

VOID list(LIST_V);

declare a list

VOID enqueue(LIST, ANY);

enqueue element on list

ANY dequeue(LIST);

dequeue and return element from list

VOID requeue(LIST, ANY);

requeue an element on list

VOID push(LIST, ANY);

push element on list

ANY pop(LIST);

pop and return element from list

VOID setel(LIST, INT, ANY);

array element assignment

ANY getel(LIST, INT);

array element selection

forlist (LIST, ANY_V, INT_V) { commands }

loop through all elements of list

LifeLines provides general purpose lists that can be accessed as queues, stacks or arrays. A list must be declared with the list function before it can be used.

A list can have any number of elements. Empty returns true if the list has no elements and false otherwise. Length returns the length of the list. The only parameter to both is a list.

Enqueue, dequeue and requeue provide queue access to a list. Enqueue adds an element to the back of a queue, dequeue removes and returns the element from the front of a queue, and requeue adds an element to the front of a queue. The first parameter to all three is a list, and the second parameter to enqueue and requeue is the value to be added to the queue and can be any value.

Push and pop provide stack access to a list. Push pushes an element on the stack, and pop removes and returns the most recently pushed element from the stack. The first parameter to both is a list, and the second parameter to push is the value to be pushed on the stack and can be of any type.

Setel and getel provide array access to a list. Setel sets a value of an array element, and getel returns the value of an array element. The first parameter to both is a list; the second parameter to both is an integer index into the array; and the third parameter to setel is the value to assign to the array element and can be of any type. Array elements are indexed starting at one. Unassigned elements are assumed to be null (0). Arrays automatically grow in size to accommodate the largest index value that is used.

Forlist is an iterator that loops through the element in a list. Its first parameter is a LIST expression; its second parameter is a variable that iterates through the list elements; and its third parameter is an integer counter variable that counts the list elements starting at one.