Exemplo n.º 1
0
 private void FoldHelper <T>(List <T> list, FoldBlock <T> expand, ParameterisedBlock result, LoadableValue curr_result, int it)
 {
     if (it < list.Count)
     {
         expand(it, list[it], curr_result, (next_result) => FoldHelper(list, expand, result, next_result, it + 1));
     }
     else
     {
         result(curr_result);
     }
 }
Exemplo n.º 2
0
 /**
  * Generate code for a list using a fold (i.e., each computation in the list
  * is made from the previous computation).
  */
 public void Fold <T>(LoadableValue initial, List <T> list, FoldBlock <T> expand, ParameterisedBlock result)
 {
     FoldHelper(list, expand, result, initial, 0);
 }