Does Coffeescript support nested list comprehensions?
coffeescript
Solution
AFAIK, you can not, see: https://github.com/jashkenas/coffee-script/issues/1191
A workaround in the meantime (until CoffeeScript gets improved):
pages = [
[
{ myvar: 1},
{ myvar: 2},
{ myvar: 3},
]
];
result = []
for row in pages
for map in row
result.push map.myvar
console.log result
which outputs:
[ 1, 2, 3 ]
Problem
For example, given the following structure ``` pages = [ [ { myvar: 1}, { myvar: 2}, { myvar: 3}, ] ]; ``` How can I express the folling (python-like) comprehension? ``` v.myvar for p in pages for v in p ```