OpenMath Content Dictionary: list3

Canonical URL:
http://www.openmath.org/cd/list3.ocd
CD Base:
http://www.openmath.org/cd
CD File:
list3.ocd
CD as XML Encoded OpenMath:
list3.omcd
Defines:
difference, entry, length, list_of_lengthn, select
Date:
2004-11-02
Version:
3 (Revision 1)
Review Date:
2004-11-01
Status:
experimental

Several standard operations on lists, such as length and append, are given in this CD.

Initiated by Arjeh M. Cohen 2004-03-02

length

Role:
application
Description:

This symbol represents a function whose argument should be a list. It returns the length of its argument.

Example:
The length of the list [1,2,3] is 3.
length ( ( 1 , 2 , 3 ) ) = 3
Signatures:
sts


[Next: list_of_lengthn] [Last: select] [Top]

list_of_lengthn

Description:

This symbol represents a function with two arguments, the first of which is a natural number and the second of which is a list. The first argument is the length of the list.

Example:
A list L of length 3:
list_of_lengthn ( 3 , ( L ) )
Signatures:
sts


[Next: entry] [Previous: length] [Top]

entry

Description:

This symbol represents a binary function whose first argument should be a list L and whose second argument should be a positive integer i such that the absolute value of i is in the interval [1..n], where n is the length of L. If i is positive, it returns the i-th entry L[i] of L, if i is negative it returns the (n+1-i)-th entry of L.

Example:
The second entry of the list [1,2,3] is 2.
entry ( ( 1 , 2 , 3 ) , 2 ) = 2
Example:
Specification of the second element of the list [1,..,6] counted from the end.
entry ( ( 1 , 2 , 3 , 4 , 5 , 6 ) , -2 ) = 5
Signatures:
sts


[Next: difference] [Previous: list_of_lengthn] [Top]

difference

Description:

This symbol takes two arguments both a list. It represents a function which returns a list made up of all the elements of the first list which are not in the second.

Example:
Specification of the list [1,..,6], apart from the first 3 elements.
difference ( ( 1 , 2 , 3 , 4 , 5 , 6 ) , ( 1 , 2 , 3 ) ) = ( 4 , 5 , 6 )
Signatures:
sts


[Next: select] [Previous: entry] [Top]

select

Description:

This symbol takes two lists as arguments, L and M say. The second argument is a list containing only entries from [1..n], where n is the length of L. The symbol represents the function which returns a list whose length is equal to the length of M, and having at position k the value of L at position M_k.

Example:
select ( ( 4 , 5 , 6 , 7 , 8 , 9 ) , ( 3 , 5 , 2 , 2 ) ) = ( 6 , 8 , 5 , 5 )
Signatures:
sts


[First: length] [Previous: difference] [Top]