for comprehension syntax supports iterating over multiple variables. It's essentially equivalent to a combination of flat_map and map.
--
You received this message because you are subscribed to the Google Groups "elixir-lang-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-ta...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-talk/20150816234717.1b46ff6d.eksperimental%40autistici.org.
For more options, visit https://groups.google.com/d/optout.
n = 100m = 50all = Enum.to_list(1..100)remove =for i <- 1..(m - 1),j <- i..div(m - 1, 2 * i + 1),do: i + j + 2 * i * jIO.inspect Enum.map(all -- remove, &(2 * &1 + 1))
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-talk/20150817020446.278b3f05.eksperimental%40autistici.org.
I would like to implement the idea with the map,
but how can I keep the state over the iterations?