gregvaughn

gregvaughn

José, I just watched your Twitch stream of day 10 of Advent of Code and, as a fan of for comprehensions, I enjoyed the time you spent discussing potential extensions of them. I recall learning about the reduce option the last time you streamed AoC. I’d like to start a thread to discuss some of those things you discussed. Twitch

I have found myself treating for more like with and sometimes using = in the clauses. My initial thoughts are that it is not a big problem to expect that level of understanding in order to use a group_by or sort_by option. However, I might also be convinced of group_by and sort_by options being a function if they could receive a binding.

I also am intrigued by your suggestion of with. My first thought went to let (allowing multiple of those) in which case they are mutable and the for comprehension can return them as a second binding param.

More thoughts and discussion?

First 2 of 2 Posts Switch mode

gregvaughn

gregvaughn OP

I hesitate to ping you directly because I know you are busy @josevalim but from your day 13 Twitch livestream (Twitch) I see this is still on your mind.

I am in favor of how you have developed the let idea within a for comprehension (and how it can let us deprecate the :reduce option). Like the live chatters in the livestream, I too have a concern about let!/1 so I would prefer that a for that uses let return a 2 element tuple. Is there a benefit of the 2nd element of that tuple being a binding rather than a tuple of the let vars?

josevalim

josevalim

Creator of Elixir

Oh, I missed this thread. Yeah, I should submit a proposal by today for for-let. It no longer has let! but retains the rest of the proposal. :slight_smile: thanks for the feedback!

— All posts loaded —

Where Next? Top

Trending in Discussions Top

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2977 91561 914
New
byu
@chrismccord : I just saw the Extract AGENTS.md from Phoenix.new into phx.new generator commit to the phoenix project. My initial shotgu...
New
arcanemachine
I was working on an Ecto migration and I needed a timestamp. So, for the nth time, I looked up the different data types for timestamps, a...
New
AstonJ
Just a general thread to post chat/news/info relating to AI/ML stuff that may be relevant for Nx now or in the future. Got anything to sh...
New
type1fool
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
juhalehtonen
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
alexslade
Fly’s CEO posted this recently - Turn And Face The Strange · The Fly Blog It says that Fly is going all-in on sprites, which is a worry ...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
akoutmos
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New
wintermeyer
There are three potential reasons for members of this forum to have a look at https://vutuv.de You are tired or annoyed of LinkedIn. Yo...
New

We're in Beta

About us Mission Statement