4 ms·
elixir is awesome, and it's the language i use on my personal projects. But it's still pretty immature and if you're writing a web application, rails will get
by anko 9y ago
elixir is awesome, and it's the language i use on my personal projects. But it's still pretty immature and if you're writing a web application, rails will get you further, quicker.
With rails when i'm writing some new code quite often i'll open pry and experiment. %w!bob tom harry!.<tab><tab> gives me all the things I can do on this array. So maybe I'd do %w!bob tom harry!.sort
If i'm in iex (the elixir equivalent REPL) I have no such help! first, I can't use %w! to define an array, and secondly You can't call things like that. The equivalent is
['bob', 'tim', 'atom'] |> Enum.sort
which isn't discoverable in the same way
- xiaoma 9y ago> "first, I can't use %w! to define an array, and secondly You can't call things like that." The second part is a pretty fundamental language difference but you can use sigils to handle the first part. E.g., to generate word lists use ~w like so: ~w(bob tom harry) If you don't want to use parens, you could use pointy brackets, braces, pipes or a few other delimiters instead.
- anko 9y agothanks for the tip!