EEP 77: comprehension assignments

Adds assignments Pattern = Expression to comprehension qualifier lists.

https://github.com/erlang/eep/pull/74

3 Likes

This is very nice! I just checked (because I remembered needing this), we have plenty of really short lists:map or lists:filter, that would be well suited for comprehensions where it was too annoying to write the filter or result as an express (esp. records).

Oh!

[Z || X <- Ls,
      is_tuple(Y = g(X)),
      Z <- f(Y, h(element(2,Y)))].

All these years and I’m still learning new tricks :slight_smile: