- public Object reduce(Tree t) {
- Object[] ret = new Object[t.numChildren()];
- for(int i=0; i<t.numChildren(); i++) {
- Tree tc = t.child(i);
- if (tc.head() != null && tc.head() instanceof Reducer)
- ret[i] = ((Reducer)tc.head()).reduce(tc);
+ public Object invoke(Iterable<Tree> t) {
+ ArrayList ret = new ArrayList();
+ for(Tree tc : t) {
+ if (tc.head() != null && tc.head() instanceof Functor)
+ ret.add(((Functor<Iterable<Tree>,Object>)tc.head()).invoke(tc.children()));