Comprehension lists #2175
manuel-rubio
started this conversation in
Ideas & suggestions
Replies: 1 comment
-
In Gleam we avoid having multiple ways to do things, and comprehensions don't enable the programmer to do anything new, so I don't think they would be a high value addition. Having said that, you can achieve the same effect with use expressions. let pairs = {
use x <- list.flat_map(xs)
use y <- list.map(ys)
#(x, y)
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
As a good Erlanger, I like the possibility to perform this kind of action. I know that it's like a shortcut for something we could do with
list.map/2
andlist.filter/2
, but I think that's very expressive and convenient.It could be implemented in the Erlang way:
or it could be implemented in the Elixir (and almost Python) way:
what do you think?
Beta Was this translation helpful? Give feedback.
All reactions