Re:Unpacking Elixir: Concurrency
by cpursley on Friday August 25, 2023 @07:40AM
(#37260567)
Vs which other languages - do you have examples of better patterns?
[ Parent
| on HN ]
Re:Unpacking Elixir: Concurrency
by peoplefromibiza on Friday August 25, 2023 @07:45AM
(#37260610)
all the C family
all the JVM languages
all the .Net languages
Rust
Ruby
Python
etc.
Re:Unpacking Elixir: Concurrency
by throwawaymaths on Friday August 25, 2023 @08:25AM
(#37260911)
Python lists are generally not contiguously allocated memory (I think it might be if you are storing integers less than 255), don't be fooled. That's why you need numpy.
Re:Unpacking Elixir: Concurrency
by peoplefromibiza on Friday August 25, 2023 @08:53AM
(#37261138)
I'm talking about Python arrays
https://docs.python.org/3/library/array.html
>>> a = array('B', [1, 2, 3, 4, 5])
>>> str(a.buffer_info()[1] * a.itemsize) + " bytes at address #" + str(a.buffer_info()[0])
'5 bytes at address #4379640336'
>>> b = array('l', [1, 2, 3, 4, 5])
>>> str(b.buffer_info()[1] * b.itemsize) + " bytes at address #" + str(b.buffer_info()[0])
'40 bytes at address #4380812752'Thanks. What's the Ruby example? It's the one I'm most familiar in.
Re:Unpacking Elixir: Concurrency
by peoplefromibiza on Friday August 25, 2023 @08:23AM
(#37260891)
irb(main):002:0> ["GFG", "GFG", "GFG", "GFG"].class
=> Array
irb(main):003:0> {1 => "CFG", 2 => "CFG"}.class
=> Hash
irb(main):006:0> {1 => "CFG", 2 => "CFG"}.keys.class
=> Array
irb(main):007:0> {1 => "CFG", 2 => "CFG"}.values
=> ["CFG", "CFG"]
irb(main):008:0> {1 => "CFG", 2 => "CFG"}.values.class
=> Array
Re:Unpacking Elixir: Concurrency
by heisenbugs on Friday August 25, 2023 @10:15PM
(#37269337)
You can achieve a similar goal with the Akka framework on the JVM (functionally native with Scala). Uses the actor model and message passing for every concurrency goal achieved by Elixir. AND you can bundle in all your existing jars if the Java world matters to you.