List: discuss@lists.openscad.org
From: Torsten Paul
Re: [OpenSCAD] How to add all the values in a list together
Mon, Jun 22, 2015 7:33 PM
On 06/22/2015 09:21 PM, cn145912 wrote:
> If I have a list
> a = [1, 5, 7, 90, 10];
> how would I add all the values together to get 115?
>
One option (should work even with long lists, if I did not mess up the tail recursion...):
function sum(list, idx = 0, result = 0) = idx >= len(list) ?