list (action)¶
Syntax¶
Parameters¶
expression<#>- A numeric expression.
Returns¶
A single list consisting of the value parameters.
Description¶
The list() action returns a list containing the values represented by a given
set of expressions. Each expression must evaluate to a numeric value or a list.
list expressions are flattened into the larger single list.
Examples¶
This first example initialize a shared list primes to the first 10 prime
numbers.
In this second example, each agent has a list-variable that is initialized to that agent's ID number, age (as an integer), sex (1 = M, 0 = F), and race code as defined in synthetic population.
variables {
agent list my_attribute_list
}
startup {
my_attribute_list = list(id(), age(), 99, 101)
}
In this final example, a new list is built from an existing list.
After this code, the list new_list will contain the list (10, 1, 2, 3, 20, 30).