1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-28 17:00:00 +02:00

add sum.scad

This commit is contained in:
Justin Lin
2020-02-26 12:32:26 +08:00
parent 2ec87b2287
commit 2598fb2be2
2 changed files with 5 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
function _sum_impl(lt, leng, i = 0) =
i == leng - 1 ? lt[i] : (lt[i] + _sum_impl(lt, leng, i + 1));

View File

@@ -0,0 +1,3 @@
use <experimental/_impl/_sum_impl.scad>;
function sum(lt) = _sum_impl(lt, len(lt));