Tinderbox v10 Icon

list(expressionList)


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

Operator in Current Baseline: 

Operator Last Altered: 

 Function  [other Function type actions]

 Item  [operators of similar scope]

 Data manipulation  [other Data manipulation operators]

 v5.10.0

 Baseline

 As at baseline


list(expressionList)

This function returns the evaluated format of each of its comma-delimited argument list of expressions.

Expression arguments can be:

The function is also useful as a method of assembling lists of attributes or expressions for action functions using lists such as count(), max() and min():

FAILS: $MyDate = max($MyDateA,$MyDateB,$MyDateC);

The latter fails as max() interprets the list as 3 literal strings "$MyDateA", etc., and does a lexical sort on those values. However:

WORKS: $MyDate = max(list($MyDateA,$MyDateB,$MyDateC));

Functions creating lists (sum(), links(), collect(), etc.) do not have the same problems with the likes of max as the former output a valid list that can be used directly. For instance:

WORKS: $MyDate = max(links.outbound.attended.$MyDate);

For more complex examples, where list items are action code expressions, it may be necessary to use eval() to wrap each list item expression, e.g. list(eval(expressionA),eval(expressionB)).

Examples

This returns a list of numbers resulting from simple evaluations:

Code: list(4+5,9-3,100/2.5)

Output value, a list: 9;6;40

This example, this makes a single evaluated string out of a list of two expressions:

Code: list("This note 's $Width is "+$Width, "the $Xpos is "+$Xpos).format(" and ")+"!")

Output value, a string: This note's $Width is 3 and the $Xpos is 48.5!

This example is not overly complex but points to how list() can be used in constructing output strings/lists that are otherwise difficult to create. The more complex the expressions passed to list() the greater the likelihood of getting no output, or an unexpected one. If complex inputs do not work consider using more parentheses to help TB figure the order of sub-task execution or else put the result of expressions into new attributes and then pass the value of the latter into list() as an argument.