src/main/php/Reducer.php
public function toSum(callable $summer = null)
    {
        if (null === $summer) {
            $summer = function($sum, $element) { return $sum += $element; };
        }

        return $this->with($summer, 0);
    }
public function toSum(callable $summer = null)
    {
        if (null === $summer) {
            $summer = function($sum, $element) { return $sum += $element; };
        }

        return $this->with($summer, 0);
    }
public function toSum ( callable $ summer = null ) { if ( null === $ summer ) { $ summer = function ( $ sum , $ element ) { return $ sum += $ element ; } ; } return $ this -> with ( $ summer , 0 ) ; }
reduce to sum of all elements

@api
@param   callable $summer  optional  different summing function, i.e. when elements are not numbers
@return  int
reduce to sum of all elements