mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-01-01 09:49:45 +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:
|
// Example:
|
||||||
// sum([1,2,3]); // returns 6.
|
// sum([1,2,3]); // returns 6.
|
||||||
// sum([[1,2,3], [3,4,5], [5,6,7]]); // returns [9, 12, 15]
|
// 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 :
|
_i>=len(v)? _acc :
|
||||||
sum(
|
sum(v, _i=_i+1, _acc=is_undef(_acc)? v[_i] : _acc+v[_i]);
|
||||||
v, _i=_i+1,
|
|
||||||
_acc=v[_i] + (is_undef(_acc)? 0 : _acc)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// Function: cumsum()
|
// Function: cumsum()
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
BOSL_VERSION = [2,0,75];
|
BOSL_VERSION = [2,0,76];
|
||||||
|
|
||||||
|
|
||||||
// Section: BOSL Library Version Functions
|
// Section: BOSL Library Version Functions
|
||||||
|
|
Loading…
Reference in a new issue