Adding values within a list and create a new list


#1

here we go,
list : 2,2,2,2,2

the output should be like this logic:
new list :
first item stays same: 2
second item: first item + second item = 2+2 = 4
third item : first + second + third = 2+2+2 =6 and so on.

final output: 2,4,6,8,10

any idea guys?


Merging Lists
#3

this list should be appropriate to attack:
input:
list: 1500,800,2500,1100,3500,1400,4500,1700
ouput: 1500,(1500+800), (1500+800+2500)…and so on


#4

You could try the simple solution outlined here:

Here’s a screenshot as applied to your example list.


#5

Effective. thanks for the solution.
I have a question. What does the DSCore in the recursive node do? i mean you have written , 1…DSCore.List.Count(a)


#6

It is necessary if one have a package installed that also have a list.count function etc. this specifies that it is the build in method that is required.
These two are the same:
image


#7

It just accesses the Count function from the Design Script core used by Dynamo. You don’t need to worry about it :slight_smile:
As you can see from my screenshot, you don’t even have to write it for the count function to work.
Please mark the solution as solved.


#8

yeah, i tried without DSCore and it worked before seeing the replies of its usage. Cool idea. ll mark it.


#9

Thanks for the info. that’s an insight into the dynamo to know something exists…


#10

I’ll take the liberty of moving the solution mark to the comment showing the solution provided by @sed07


#11

by the way, what’s the advantage of getting one’s comment, marked as solution. I am new to forum for posting questions, though i frequently seek help from the threads.


#12

The advantage is that the solution will be moved to the top of the thread and that way people searching information does not have to scroll though a long thread if only the solution is indeed required :slight_smile: For someone there is no “advantage” except from the acknowledgement of having provided a work-able solution :slight_smile:


#13

thats nice to know. “Service” and knowledge sharing… thanks for the help guys… i will try to help as well.


Grid, Formula, Array