List AL intrinsics


Defined (any list l) result logical
Return true if the current element of the list is within the list. Note that the value of the current element may actually be undefined. See also the basic intrinsic Defined.

First (any list l)
Set the current element of the list to the first element in it.

Last (any list l)
Set the current element of the list to the last element in it.

Next (any list l)
Change the current element to be the next one in the list.

Previous (any list l)
Change the current element to be the previous one in the list.

Purge (any list l)
Remove multiple occurrences of elements with the same value in the list.

Empty (any list l)
Remove all elements from the list.

Slim (any list l)
Reduce allocation of element slots in list to the minimum needed.

Size (any list l) result integer
Return number of elements in the list.

Current (any list al) result a
Return the current element of the list. If the current element is outside of the list, then an error occurs.

Set_current (any list al; any a)
Put the value of a into the current element of the list. If the current element is outside of the list, then an error occurs.

Search (any list al; any a)
Search for an element of the value a in the list, starting from the current element. If an element is found, then the current element is set to it, otherwise the current element is set to after the list.

Position (any list al) result integer
Return the slot number of the current element of the list. If the current element is before the list, then 0 is return. If the current element is after the list, then an impossibly high value is returned.

Set_position (any list al; integer i)
Set the current element to be at the given slot number. No error occurs if the position is outside of the list.

Get (any list al; integer i) return a
Get the value of the element at slot i in the list. An error occurs if the slot value is outside the list.

Put (any list al; integer i; any a)
Put in the value of a as the element at slot i in the list, overwriting the value of the previous element at that slot. An error occurs if the slot value is outside the list.

Into (any list al; any a)
Put in the value of a at the end of the list.

Follow (any list al; any a)
Put in the value of a after the current element of the list. If the current element is before the list, then the value is put in as the first element. If the current element is after the list, then the value is put in after the last element.

Out (any list al)
Remove the current element from the list. The next element becomes the new current element of the list. An error occurs if the slot value is outside of the list.

Remove (any list al; any a)
Remove any elements in the list with the given value.

Member (any list al; any a) result logical
Return true if an element of the given value is present in the list.

Join (any list l1, l2) result any list
Concate lists l1 and l2 and return the result.

Intersect (any list l1, l2) result any list
Return a list which contains all elements in list l1 which also occur in list l2.

Differ (any list l1, l2) result any list
Return a list which contains all elements in list l1 which do not occur in list l2.

Sort (any list al; logical b) result integer list
Return a list of integers to be used with the procedure Rearrange to sort the list. The sorting is in ascending order if the logical b is true, otherwise descending.

Rearrange (any list al1; integer list il) return any list
Return a list which is a rearrangement of list al1, with the elements put in the new slots given by the integer list. The integer list is usually obtained from the procedure Sort.

Per Kraulis 18 Apr 1996.