It’s called a list comprehension Single- and multi-dimensional Arrays · The Julia Language
but what is this exactly equivalent to?
It is a syntax for lazy map, filter, and a products over iterators. That is,
If you write
[f(x, y) for x in xs, y in ys if g(x, y)]
then that is equivalent to
itr1 = Iterators.product(xs, ys)
itr2 = Iterators.filter(((x, y),) -> g(x, y), itr1)
itr3 = Iterators.map(((x, y),) -> f(x, y), itr2)
collect(itr3)
allocating an array, usually without any intermediates.
If you instead wrote
(f(x, y) for x in xs, y in ys if g(x, y))
then that would be called a “generator comprehension” and this would not do the final collect stage, just returning an unmaterialized iterator.