protocol
List of numbers protocol.
Paulo Moura
1.3
2011/12/15
static
(no dependencies on other files)
Calculates the product of all list numbers. Fails if the list is empty.
static
product(List,Product)
product(+list(number),-number) – zero_or_one
Calculates the sum of all list numbers. Returns the integer zero if the list is empty.
static
sum(List,Sum)
sum(+list(number),-number) – one
Calculates the average (i.e. arithmetic mean) of a list of numbers. Fails if the list is empty.
static
average(List,Average)
average(+list(number),-float) – zero_or_one
Calculates the Euclidean norm of a list of numbers. Fails if the list is empty.
static
euclidean_norm(List,Norm)
euclidean_norm(+list(number),-float) – zero_or_one
Calculates the Chebyshev norm of a list of numbers. Fails if the list is empty.
static
chebyshev_norm(List,Norm)
chebyshev_norm(+list(integer),-integer) – zero_or_one
chebyshev_norm(+list(float),-float) – zero_or_one
Calculates the Manhattan norm of a list of numbers. Fails if the list is empty.
static
manhattan_norm(List,Norm)
manhattan_norm(+list(integer),-integer) – zero_or_one
manhattan_norm(+list(float),-float) – zero_or_one
Calculates the Euclidean distance between two lists of numbers. Fails if the two lists are empty or not of the same length.
static
euclidean_distance(List1,List2,Distance)
euclidean_distance(+list(number),+list(number),-float) – zero_or_one
Calculates the Chebyshev distance between two lists of numbers. Fails if the two lists are empty or not of the same length.
static
chebyshev_distance(List1,List2,Distance)
chebyshev_distance(+list(integer),+list(integer),-integer) – zero_or_one
chebyshev_distance(+list(float),+list(float),-float) – zero_or_one
Calculates the Manhattan distance between two lists of numbers. Fails if the two lists are empty or not of the same length.
static
manhattan_distance(List1,List2,Distance)
manhattan_distance(+list(integer),+list(integer),-integer) – zero_or_one
manhattan_distance(+list(float),+list(float),-float) – zero_or_one
Calculates the scalar product of two lists of numbers. Fails if the two lists are empty or not of the same length.
static
scalar_product(List1,List2,Product)
scalar_product(+list(integer),+list(integer),-integer) – zero_or_one
scalar_product(+list(float),+list(float),-float) – zero_or_one
(none)
(none)