Skip to content
Advertisement

resolve matrix lists with lambda and map

we have 3 lists in below

JavaScript

so , how we can sum all of similar index in lists together? i mean is 2 and 5 and 8 be sum together & 3 and 6 and 9 also be sum together & 4 and 7 and 10 as well ? but just use lambda and map…

actually i have no idea for that and this code is just for sending this question

JavaScript

Advertisement

Answer

to get them all together use zip:

JavaScript

output:

JavaScript

to sum them up you can use sum and map:

JavaScript

output:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement