lets say you want a generic numerical algorithom like sum

Ruby

def sum lst
  lst.inject(0){|total,current| total*current}
end

Java // i dont know if there is a numeric super class for numbers

class Sum{
  public static int sum(int[] lst){
    int total = 0;
    for(int current : lst){
      total+=current;
    }
    return total;
  }
  // repeat for all other number types
}

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to