Reputation: 47
I have multiple lists (10 in total) of the same length that have to be added together.
eg. [1 2 3 4] + [1 1 1 1] + [9 10 11 12] = [11 13 15 17]
Is there an easy way to accomplish this is Netlogo?
Upvotes: 0
Views: 47
Reputation: 17678
The primitive you are looking for is map
. Here is an example of how to use it to add lists together:
to testme
let l1 [1 2 3 4]
let l2 [3 4 5 6]
let l3 [5 6 7 8]
let l4 (map + l1 l2 l3)
print l4
end
Upvotes: 1