vector of values of elements in a set or character string
v = value(e)
set or character string
vector of values
It is possible to assign values to the elements of a set. This enables one, for example, to have sets of coins, tickets or playing cards with values. For this, the value is given by placing them in parentheses at the end of the name of an element. For example to create a set of 3 coins called "a", "b" and "c", with values 1 euro, 1 euro and 2 euros, one writes :
set1=define_set("a(1)","b(1)","c(2)").
The function value
returns the vector of values for the elements of a set,
allowing numerical calculations to be done with them.
If an element does not have a value, the value of 0 is assumed.
If e
is a character string, and its elements represent digits,
the result is a vector of corresponding digits. This allows, for example, to obtain the vector of digits in an integer
n
by using the function call
value(string(n))
.