3 ms·
Build your own lazy operation evaluator in Elixir
- deofoo 3y agoThat's pretty cool and can scale well for parallel or concurrent computing.
- freedomben 3y agoFor those new to Elixir it may not be immediately obvious why this is so cool. You can do the same thing in Javascript by passing functions in object properties after all right? With Elixir, the struct is immutable which means it can be safely accessed in parallel without dealing with locking/mutexes. You also have a horizontally scalable "cluster" of machines (even on a single physical machine, this is over-simplified but it's an accurate mental model) so you could easily have some producer that is creating these expensive math ops and pushing them onto a queue, and then a pool of "workers" that run the actual execution distributed across cluster CPUs. And this can be done fairly easily with idiomiatic Elixir, without adding external dependencies! Really neat stuff.
- Snacklive 3y agoThank you for this summary, i am new to Elixir and ready about this cool stuff makes me want to keep learning the language
- ralphc 3y agoIt gets better. With Elixir's Nx will take a subset of Elixir and compile it to GPU code so the expensive math ops can be farmed out to other machines and run on their GPUs in parallel.