collect

File collect.str
Author unknown
Since unknown

Collecting subterms.

There are two main variants of collect strategies: collect-all and collect-om.

The collect-all strategies continue collecting terms in the subterms of a term that has already been collected.

The collect-om strategies do not collect subterms of collected terms. They collect only the outermost subterms that satisfy some condition.

For example: if terms matching the term pattern A(_,_) should be collected, then in the term

A(1, A(1, 2))

collect-all variant will return

A(1, A(1, 2)) and A(1, 2).

collect-om will only return the outermost result, that is,

A(1, A(1, 2)).




Statistics


General
Lines of code 192
Stratego
Module number 1 (100% documented)
Constructor number 0
Overlay number 0
Strategy number 19 (52% documented)
Rule number 1 (100% documented)
DynamicRule number 0



Strategy summary


atmostonce(Strategy s) n/a collect.str
bu-collect(Strategy s) n/a collect.str
collect(Strategy s) Synonym of collect-om collect.str
collect(Strategy s, Strategy skip) n/a collect.str
collect-all(Strategy s) collect all subterms for which s succeeds collect.str
collect-all(Strategy s, Strategy un) collect all subterms with user-defined union operator collect.str
collect-all(Strategy s, Strategy un, Strategy reduce) collect all subterms with user-defined union operator and a skip argument collect.str
collect-exc(Strategy base, Strategy special) n/a collect.str
collect-om(Strategy s) collect outermost subterms for which s succeeds collect.str
collect-om(Strategy s, Strategy op) collect outermost subterms with user-defined union operator collect.str
collect-om(Strategy s, Strategy un, Strategy skip) collect outermost subterms with user-defined union operator and a skip argument collect.str
collect-one(Strategy s) collect a single, outermost value from a tree collect.str
collect-split(Strategy f, Strategy g) Produces pair of a reduced term and a list of extracted subterms collect.str
collect-split(Strategy splitter) n/a collect.str
collect-split'(Strategy splitter) n/a collect.str
CollectSplit(Strategy s, Strategy f, Strategy g) Helper of collect-split collect.str
postorder-collect(Strategy s) n/a collect.str
postorder-collect(Strategy s, Strategy acc) n/a collect.str
twicetd(Strategy s) n/a collect.str

Rule summary


CollectSplit(Strategy s, Strategy splitter) Helper of collect-split collect.str



Strategy details


ATerm collect(Strategy s)
File collect.str
Author unknown
Since unknown
 

Synonym of collect-om.



 
ATerm collect-all(Strategy s)
File collect.str
Author unknown
Since unknown
 

collect all subterms for which s succeeds

This strategy returns a *set* of subterms. The resultwill therefore not contain duplicates.



 
ATerm collect-all(Strategy s, Strategy un)
File collect.str
Author unknown
Since unknown
 

collect all subterms with user-defined union operator.

The un argument must take two lists and produce a single one.



 
ATerm collect-all(Strategy s, Strategy un, Strategy reduce)
File collect.str
Author unknown
Since 0.9.6
 

collect all subterms with user-defined union operator anda skip argument.

The un argument must take two lists and produce a single one.If duplicates must be removed, then this argument should be union, otherwise it usually conc.

The reduce argument can be used to reduce the current term beforecollecting subterms of it. Producing the empty list will resultin a complete skip of all subterms.

example:collect-all(?Var(_), conc, \ Assign(_, e) -> e \)

applied to:Assign(Var("x"), Plus(Var("y"), Var("z")))

results in:[Var("y"), Var("z")]

The collect-all is applied to the term after the reduce, i.e theexample collect-all applied to

Assign(Var("x"), Var("y"))

results in:[Var("y")]



 
ATerm collect-om(Strategy s)
File collect.str
Author unknown
Since unknown
 

collect outermost subterms for which s succeeds

This strategy returns a *set* of subterms. The resultwill therefore not contain duplicates.



 
ATerm collect-om(Strategy s, Strategy op)
File collect.str
Author unknown
Since unknown
 

collect outermost subterms with user-defined union operator.

The un argument must take two lists and produce a single one.



 
ATerm collect-om(Strategy s, Strategy un, Strategy skip)
File collect.str
Author unknown
Since 0.9.6
 

collect outermost subterms with user-defined union operator anda skip argument.

See collect-all(s, un, skip) for a description of the arguments.



 
ATerm collect-one(Strategy s)
File collect.str
Author unknown
Since unknown
 

collect a single, outermost value from a tree.



 
ATerm collect-split(Strategy f, Strategy g)
File collect.str
Author unknown
Since unknown
 

Produces pair of a reduced term and a list of extracted subterms.

Reduces terms with f and extracts information with g resulting in apair (t, xs) of a reduced term and the list of extracted subterms.



 
ATerm CollectSplit(Strategy s, Strategy f, Strategy g)
File collect.str
Author unknown
Since unknown
 

Helper of collect-split. Don't use.



 

Rule details


ATerm CollectSplit(Strategy s, Strategy splitter)
File collect.str
Author unknown
Since unknown
 

Helper of collect-split. Don't use.