Tinderbox v9 Icon

List/Set.collect_if(label,expression)


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

Operator Altered: 

 Function   [other Function type actions]

 List   [operators of similar scope]

 Dictionary, Set & List operations   [other Dictionary, Set & List operations operators]

 9.0.0

 


List/Set.collect_if(label, expression)

Each item in the list is bound in turn to label, and then the expression is evaluated. The operator returns a list of all the results.

$MyListA = $MyList.collect_if(x,x<3,x); returns 1;2

$MyListA = $MyList.collect_if(x,mod(x,2),x); returns 1;3;5

$MyListA = $MyList.collect_if(x,mod(x,2),x*x); returns 1;9;25

If $MyList is “Winken;Blinken;Nod", then:

$MyListA = $MyList.collect_if(x,x.lowercase); winken;blinken;nod

$MyListA = $MyList.collect_if(x,x.contains('i'),x.lowercase); winken;blinken



A Tinderbox Reference File : Actions & Rules : Operators : Full Operator List : List/Set.collect_if(label,expression)