Fastest approach to returning a vector of elements choose 2

it is a good question, and one that has been discussed in the past

I don’t think such a feature was ever ruled out, but it has also not yet been implemented

If you have this need, it may be difficult to do it as a snazzy comprehension one-liner.

You may notice that (i for i in 1:10 if iseven(i)) internally uses Iterators.Filter, but you are free to call Iterators.Filter directly

  • (foo(x) for x in itr if cond(foo(x)))

becomes

  • Iterators.Filter(cond, (foo(x) for x in itr))
1 Like