mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2024-12-29 16:29:40 +00:00
Fixed bug introduced into sum() when summing lists of vectors.
This commit is contained in:
parent
48d30fc686
commit
231bb69634
2 changed files with 3 additions and 6 deletions
|
@ -429,12 +429,9 @@ function lcm(a,b=[]) =
|
|||
// Example:
|
||||
// sum([1,2,3]); // returns 6.
|
||||
// sum([[1,2,3], [3,4,5], [5,6,7]]); // returns [9, 12, 15]
|
||||
function sum(v, _i=0, _acc=undef) =
|
||||
function sum(v, _i=0, _acc) =
|
||||
_i>=len(v)? _acc :
|
||||
sum(
|
||||
v, _i=_i+1,
|
||||
_acc=v[_i] + (is_undef(_acc)? 0 : _acc)
|
||||
);
|
||||
sum(v, _i=_i+1, _acc=is_undef(_acc)? v[_i] : _acc+v[_i]);
|
||||
|
||||
|
||||
// Function: cumsum()
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
BOSL_VERSION = [2,0,75];
|
||||
BOSL_VERSION = [2,0,76];
|
||||
|
||||
|
||||
// Section: BOSL Library Version Functions
|
||||
|
|
Loading…
Reference in a new issue