Listclasssystype.h[394], reflect.t[322]

The native list type

Modified in reflect.t[322]:
Modify the List intrinsic class to provide a to-symbol mapping

intrinsic class List :   Collection

Superclass Tree   (in declaration order)

List
        Collection
                Object

Subclass Tree  

(none)

Global Objects  

(none)

Summary of Properties  

(none)

Summary of Methods  

append  appendUnique  car  cdr  countOf  countWhich  forEach  forEachAssoc  getUnique  indexOf  indexWhich  insertAt  intersect  lastIndexOf  lastIndexWhich  lastValWhich  length  mapAll  prepend  removeElementAt  removeRange  sort  sublist  subset  valToSymbol  valWhich 

Inherited from Collection :
createIterator  createLiveIterator 

Inherited from Object :
getPropList  getPropParams  getSuperclassList  isClass  isTransient  ofKind  propDefined  propInherited  propType 

Properties  

(none)

Methods  

append (val)systype.h[499]

append an element - this works almost exactly like the concatation operator ('+'), but if the argument is a list, this simply adds the list as a new element, rather than adding each element of the list as a separate element

appendUnique (lst)systype.h[491]
append the elements of the list 'lst' to the elements of this list, then remove repeated elements in the result; returns a new list with the unique elements of the combination of the two lists

car ( )systype.h[430]
car/cdr - head/tail of list

cdr ( )systype.h[431]
no description available

countOf (val)systype.h[478]
count the number of elements with the given value

countWhich (cond)systype.h[481]
count the number of elements for which the callback returns true

forEach (func)systype.h[448]
Invoke the callback func(val) on each element, in order from first to last. No return value.

forEachAssoc (func)systype.h[557]
Invoke the callback func(index, val) on each element, in order from first to last. No return value.

getUnique ( )systype.h[484]
get a new list consisting of the unique elements of this list

indexOf (val)systype.h[427]
get the index of the first match for the given value

indexWhich (cond)systype.h[442]
Find the first element for which the given condition is true, and return the index of the element. Applies the callback function (which encodes the condition to evaluate) to each element in turn, starting with the first. For each element, if the callback returns nil, proceeds to the next element; otherwise, stops and returns the index of the element. If the callback never returns true for any element, we'll return nil.

insertAt (startingIndex, val, ...)systype.h[535]
Insert one or more elements at the given index. If the index is 1, the elements will be inserted before the first existing element. If the index is one higher than the number of elements, the elements will be inserted after all existing elements.

Note that a list value argument will simply be inserted as a single element.

Returns a new list with the value(s) inserted.

intersect (other)systype.h[424]
intersect with another list

lastIndexOf (val)systype.h[458]
find the last element with the given value, and return its index

lastIndexWhich (cond)systype.h[469]
Find the last element for which the condition is true, and return the index of the element. Applies the callback to each element in turn, starting with the last element and working backwards. For each element, if the callback returns nil, proceeds to the previous element; otherwise, stops and returns the index of the element. If the callback never returns true for any element, we'll return nil.

lastValWhich (cond)systype.h[475]
Find the last element for which the condition is true, and return the value of the element

length ( )systype.h[418]
get the number of elements in the list

mapAll (func)systype.h[415]
Apply the callback function to each element of this list, and return a new list consisting of the results. Effectively maps the list to a new list using the given function. Suppose the original list is

[x, y, z]

Then the result list is

[func(x), func(y), func(z)]

prepend (val)systype.h[522]
Prepend an element - this inserts the value before the first existing element.

removeElementAt (index)systype.h[542]
Delete the element at the given index, reducing the length of the list by one element. Returns a new list with the given element removed.

removeRange (startingIndex, endingIndex)systype.h[551]
Delete the range of elements starting at startingIndex and ending at endingIndex. The elements at the ends of the range are included in the deletion. If startingIndex == endingIndex, only one element is removed. Returns a new list with the given element range removed.

sort (descending, ?, comparisonFunction, ?)systype.h[516]
Sort the list, returning a new list. If the 'descending' flag is provided and is not nil, we'll sort the list in descending order rather than ascending order.

If the 'comparisonFunction' argument is provided, it must be a callback function; the callback takes two arguments, and returns an integer less than zero if the first argument value is less than the second, zero if they're equal, and an integer greater than zero if the first is greater than the second. If no 'comparisonFunction' argument is provided, or it's provided and its value is nil, we'll simply compare the list elements as ordinary values. The comparison function can be provided for caller-defined orderings, such as ordering a set of objects.

sublist (start, len, ?)systype.h[421]
extract a sublist

subset (func)systype.h[401]
Select a subset of the list: returns a new list consisting only of the elements for which the callback function 'func' returns true.

valToSymbol ( )OVERRIDDENreflect.t[323]
no description available

valWhich (cond)systype.h[455]
Find the first element for which the given condition is true, and return the value of the element. Returns nil if no item satisfies the condition.

TADS 3 Library Manual
Generated on 9/13/2007 from TADS version 3.0.15.2