diff --git a/math.scad b/math.scad index 79d5ffa..720d0e6 100644 --- a/math.scad +++ b/math.scad @@ -585,7 +585,7 @@ function lcm(a,b=[]) = function sum(v, dflt=0) = v==[]? dflt : assert(is_consistent(v), "Input to sum is non-numeric or inconsistent") - is_vector(v) ? [for(i=[1:len(v)]) 1]*v : + is_vector(v) || is_matrix(v) ? [for(i=[1:len(v)]) 1]*v : _sum(v,v[0]*0); function _sum(v,_total,_i=0) = _i>=len(v) ? _total : _sum(v,_total+v[_i], _i+1);