At first, we assume that the recursive functions have a tuple value as their actual parameter, where the first element of the tuple is of recursive type. We name the first element the recursive parameter and the second element the accumulation parameter. The recursive parameter is distributed for data parallel computation. The accumulation parameter is used to propagate values to recursive computations on connected elements[11]. The proper form of the recursive functions for parallelization is formally defined as follows.
In Definition 1,
's are data constructor
patterns and they are matched to the recursive parameter.
is a pattern matched
to non-recursive field of the recursive parameter and variable patterns
's
are matched to recursive fields of the recursive parameter.
In function bodies, all recursive calls use
's as the first element
of their actual parameter and every
is used as the first element
of actual parameters of recursive calls only once.
Functions of this form apply the same function to all recursive parts of
the recursive data structure. This property is suitable for data parallel execution.
In case that
's are used in other computations, we can use tupling
transformation to fulfill our condition.
inorder program is an example which satisfies Definition 1. Labels are omitted. In the second function body, variables lt and rt which are matched to recursive fields of the recursive parameter are used as the first parameter of recursive calls only. Therefore the same function inorder is applied to every recursive element of a given tree.