Concurrency aside, why is Elixir preferred over Ruby when it doesn't even have a native array implementation? No, lists and tuples are no substitute nor are maps with numeric keys as Jose has suggested. If you want an array in Elixir your only option is Erlang's implementation which ain't pretty - http://erlang.org/doc/man/array.html . When I raised this issue in the mailing list and on IRC the response was invariabl…
Does absence of arrays look a problem for you, while general immutability of most everything and message-based approach look totally normal and easy to grasp? I suspect that to use Elixir, you need to study a new way of doing things first. Then you'll see arrays in a different light.
Rails 5.0: Action Cable, API mode, and more
101–110 of 225 posts
Re: Rails 5.0: Action Cable, API mode, and more
#102Concurrency aside, why is Elixir preferred over Ruby when it doesn't even have a native array implementation? No, lists and tuples are no substitute nor are maps with numeric keys as Jose has suggested. If you want an array in Elixir your only option is Erlang's implementation which ain't pretty - http://erlang.org/doc/man/array.html . When I raised this issue in the mailing list and on IRC the response was invariabl…
This isn't a defensive response, just a genuinely curious one. For certain types of programming - generally in lower-level languages - arrays can be essential for performance. But then my assumption is that if you needed that kind of performance, you'd be using those languages. So outside of performance, what's the functional difference between an actual array implementation - and a thing that looks, walks, and quack…
Re: Rails 5.0: Action Cable, API mode, and more
#103Earlier quoted context omitted.
I've just started learning Elixir out of interest so I can't quite answer your question. However, I'd like to ask: what have you found to be difficult to do using the Elixir types such as tuples, list, keyword lists, and maps that would otherwise be easy to do using arrays? I'm asking out of genuine curiosity because I've specifically noticed a lack of arrays when learning Elixir and I'm quite used to using them in o…
Elixir has no native array syntax nor any array functions in the stlib so arrays are basically second class citizens rather than completely absent. Ask not why I need them but why anyone might need them if the Elixir is supposed to be a general purpose language. Why does Clojure need them or Ruby or Python (lists)? If I want to process data as a large indexed array Elixir isn't going to help me and some Elixir devs h…
So you want a list it seems
> l=[1,2,3]
> [h | t] = l
[1, 2, 3]
> h
1
> t
[2, 3]
> If I want to process data as a large indexed array Elixir isn't going to help meBut neither will Python. You'd want a large indexed array you probably want numpy.
See now you are revealing a bit more about your usecase that's helpful. So you have large amount of data and want to query it and process it. In that case you might want to check out ETS. The nice benefit, you have have cool matching or query list comprehensions of it. Can also access it concurrently from multiple processes:
http://elixir-lang.org/getting-started/mix-otp/ets.html
This is the Erlang side of it:
http://learnyousomeerlang.com/ets
> but the question here is whether it is deficient in other areas, making it too much of a niche language.
Of course it is deficient. C is deficient. Java, C++ is they all. Every language is deficient in some way. I haven't found a Perfect one yet. Still looking... Maybe Rust, who knows, still struggling to learn it.
Re: Rails 5.0: Action Cable, API mode, and more
#104Earlier quoted context omitted.
Why do you want an array? You mean you want a memory area with adjacent cells layed out, to talk to C perhaps? Perhaps might want a list, a binary, or a sorted set, a tuple, a map and so on. You have to tell a bit more about your use case. I used Erlang for many years, and in the last one full time. Not one time have I needed an "array". It seems you picked one odd feature no-one uses and are upset about it, I thik i…
I would need an array for processing any large data set as an indexed collection. Why is that considered an "odd feature no-one uses" when it's a fundamental data type in most mainstream languages?
If it's iterated over sequentially then a list works perfectly.
If it's random access then a map works.
Re: Rails 5.0: Action Cable, API mode, and more
#105Concurrency aside, why is Elixir preferred over Ruby when it doesn't even have a native array implementation? No, lists and tuples are no substitute nor are maps with numeric keys as Jose has suggested. If you want an array in Elixir your only option is Erlang's implementation which ain't pretty - http://erlang.org/doc/man/array.html . When I raised this issue in the mailing list and on IRC the response was invariabl…
if you need constant time access by index to a sequence of fixed size elements you can use binaries. if you want constant time access to a sequence of fixed size you can use tuples. if you want both you can get close with maps using integer keys or with trees (which i believe are used by clojure behind the scenes for arrays)
Re: Rails 5.0: Action Cable, API mode, and more
#106Earlier quoted context omitted.
It's around 12 times faster in the general sense. Your mileage may vary. If you spend $200 you could theoretically hosting the same product on $50 worth of hardware.
That saving of $150 is equivalent to one hour of pro dev work time. It's hardly worth converting unless Elxir / Phoenix is much more productive and maintainable.
A greenfield project? Sure why not, it's a great choice.
Re: Rails 5.0: Action Cable, API mode, and more
#107By looking at the comments you'd assume a new version of Phoenix got released.
Re: Rails 5.0: Action Cable, API mode, and more
#108Earlier quoted context omitted.
I would need an array for processing any large data set as an indexed collection. Why is that considered an "odd feature no-one uses" when it's a fundamental data type in most mainstream languages?
How are you planning on accessing it though? If it's iterated over sequentially then a list works perfectly. If it's random access then a map works.
Re: Rails 5.0: Action Cable, API mode, and more
#109Earlier quoted context omitted.
Been using Elixir / Phoenix as well, and it's been a breath of fresh air. That said, I'm glad that rails has been looking at projects like Phoenix for inspiration as it continues to grow and adapt.
I'm glad that rails has been looking at projects like Phoenix for inspiration Other way around. Phoenix was explicitly inspired by Rails and founded by Rails core members. Elixir was first created by a Rails core member. Phoenix is the performance-really-matters successor to Rails.
Re: Rails 5.0: Action Cable, API mode, and more
#110Earlier quoted context omitted.
This isn't a defensive response, just a genuinely curious one. For certain types of programming - generally in lower-level languages - arrays can be essential for performance. But then my assumption is that if you needed that kind of performance, you'd be using those languages. So outside of performance, what's the functional difference between an actual array implementation - and a thing that looks, walks, and quack…
Ruby, Python and Javascript all have native array support but can hardly be considered lower-level languages.
Because of the immutable data, your best hopes are actually vectors or maps.
Btw, the erlang library you mention implements arrays on top of a tree of 10-ary(-ish) tuples. It'd need to be measured, but I'd be willing to bet that the native maps are faster at access, insert, and delete. The maps are implemented in C, and worst case for all operations would be O(n log n) or similar.