Posts

Showing posts from January 4, 2019

How to multiply nested lists by a list with the same length?

Image
up vote 5 down vote favorite 1 Here's the expected output: {{a, b}, {c, d}, {e, f}} * {3, 4} = {{3a, 4b}, {3c, 4d}, {3e, 4f}} However, the code above will multiply each element of the encompassing list (3 elements) by {3, 4} (2 elements) and cause an error. I've tried defining a function and using Map , but I'm sure there's a more elegant way of doing this speedily, without needing to first define a function. list-manipulation share | improve this question edited Nov 28 at 5:11 kglr 174k 8 196 401 asked Nov 28 at 4:53 ...