Juan David Arredondo
Juan David Arredondo

Reputation: 13

Adding elements of 3 lists in NetLogo

I have three lists [a1 a2 a3 a4][b1 b2 b3 b4][c1 c2 c3 c4]

I want to create a new list by adding elements of each list

Result: [a1+b1+c1 a2+b2+c2 a3+b3+c3 a4+b4+c4]

Upvotes: 1

Views: 47

Answers (1)

Bryan Head
Bryan Head

Reputation: 12580

Checkout map:

(map [ [a b c] -> a + b + c ] list1 list2 list3)

Upvotes: 2

Related Questions