> Languages that support it via square brackets: Rust, Ruby, Javascript,
> Python, C, Julia.
All of these languages (other than maybe Julia? I have not used it at all.) are
actually using arrays and not lists. It is fairly natural to have easy index
based lookup for arrays. After all, it is
> It was pointed out that perhaps we don't do this to express that indexing a
> list is not fast in Elixir like it is in other languages, but I'm not sure if
> that is sufficient reason IMO to leave out a typically very standard feature
> of lists.
>
> Thoughts?
Can you give an example of a
This proposal mentions OCaml, Haskell and JS as prior works of art for
this type of feature. I think a key thing to point out is that in those
languages, they did not need to add additional syntax in order to
support this.
In OCaml, the syntax goes from
{ foo = foo; bar = bar }
to
{ foo; bar }
For what's it's worth, I generally see people wanting this for map
deconstruction instead of construction. When it comes to deconstruction, we
already have a different syntax for maps with atom keys.
foo = %{bar: "baz"}
foo.bar
> Here is a really contrived example:
>
>
> Is it a ridiculous idea to add one of those symbols as a new operator
> with the right to left associativity?
As an Emacs (and light Vim) user, I would personally suggest against
something like this. At least in Emacs, it is not as simple as just
alt+keys in order to get these characters. And
There has been a lot of conversation around something like this in the
past[1][2]. I'm sure there are other examples as well.
If I recall properly, the short answer to this proposal is no, unless
someone can come up with a new spin to it. The languages that have this
feature generally have a
On Mon Jul 22, 2019 at 2:52 PM Rich Morin wrote:
> Every so often, I try to match a regexp using the case control structure, eg:
>
> case get_string() do
> ~r{^Foo} -> foo()
> ~r{^Bar} -> bar()
> _ -> baz()
> end
>
> This (AFAICT) tries to match a_string to the regexps, fails,
Is there a reason you are not using List.foldl/3?
List.foldl list, [], (fn elem, acc -> [f(x) | acc] end)
Can I ask why you are reversing a list, traversing it, just to reverse it again?
‐‐‐ Original Message ‐‐‐
On Sunday, 31 March 2019 11:58, Robert Dober wrote:
> Hi there
>
> I do
Forgive me if I am missing something obvious, but I don't quite understand how
the underscores are making your tests fail. The compiler removes them. It is
only syntactic sugar for us humans who are bad at parsing long sequences of
numbers. Would you be able to provide an example of how these