[HN Gopher] Build your own lazy operation evaluator in Elixir
___________________________________________________________________
Build your own lazy operation evaluator in Elixir
Author : clessg
Score : 60 points
Date : 2023-06-08 19:03 UTC (1 days ago)
(HTM) web link (www.germanvelasco.com)
(TXT) w3m dump (www.germanvelasco.com)
| deofoo wrote:
| That's pretty cool and can scale well for parallel or concurrent
| computing.
| freedomben wrote:
| For 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 wrote:
| Thank you for this summary, i am new to Elixir and ready about
| this cool stuff makes me want to keep learning the language
___________________________________________________________________
(page generated 2023-06-09 23:02 UTC)