LifeLines Programmers Reference

Version 3.0.2

up | previous | next | Tom Wetmore | ttw@shore.net | LifeLines


List Functions

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 may have any number of elements.

FunctionDescription
void list(list_v) List creates and returns an empty list. Its parameter is a variable. Every list must be declared in this way. List can also be used to make an existing list empty, though this causes a memory leak.
bool empty(list) Empty checks if a list is empty; it returns 1 if so; 0 otherwise.
int length(list) Length returns the length of a list.
void enqueue(list, any) Enqueue, dequeue and requeue provide queue access to a list. The first parameter to all three is the list. Enqueue adds an element to the back of a queue; its second parameter is the element.
any dequeue(list) Dequeue removes and returns the element from the front of a queue.
void requeue(list, any) Requeue adds an element to the front of a queue. Its second parameter is the element.
void push(list, any) Push and pop provide stack access to a list. The first parameter to both is a list. Push pushes an element on the stack. The second parameter to push is the element.
any pop(list) Pop removes and returns the most recently pushed element from the stack.
void setel(list, int, any) Setel and getel provide array access to a list. The first parameter to both is a list, and the second parameter to both is an integer index into the array. Setel sets a value of an array element. The third parameter to setel is the value to assign to the array element.
any getel(list, int) Getel returns the value of an array element. Array elements are indexed starting at one. Unassigned elements are assumed to be zero. Arrays automatically grow in size to accommodate the largest index value that is used.
forlist (list, any_v, int_v) { } 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.

up | previous | next | Tom Wetmore | ttw@shore.net | LifeLines

1/1/00