public class Sum implements FLVisitor_I { public static Sum only = new Sum(); private Sum() { } public Object forEmpty(Empty list) { return new Integer(0); } public Object forCons (Cons list) { Integer firstInt = list.first(); Integer restSumInt = (Integer)list.rest().execute(this); return new Integer(firstInt.intValue() + restSumInt.intValue()); } }