gt; You received this message because you are subscribed to the Google
>>>> Groups "elixir-lang-core" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to elixir-l...@googlegroups.com.
>>>> To view this discussion on
; .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elixir-lang-core+unsubscr...@googlegroups.com.
> To view this discussion on th
ps.google.com/d/msgid/elixir-lang-core/40ef0ab9-7d92-4601-b445-de7c5796c046o%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
--
Best regards
Alexei Sholik
--
You received this message because you are subscribed to the Google Groups
"elixir-lang-core" group.
To unsu
.
>>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "elixir-lang-core" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to elixir-
errDrRsa7g%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> ema
And it's also possible to update selected fields of an existing record.
This is all described in the docs:
iex(5)> r = bb()
{:bb, 1}
iex(6)> r1 = bb(r, a: 2)
{:bb, 2}
iex(7)> bb(r1, :a)
2
iex(8)> bb(a: x) = r1
{:bb, 2}
iex(9)> x
2
On Fri, Jan 3, 2020 at 11:19 AM Alexei Sh
e because you are subscribed to the Google Groups
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elixir-lang-core+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.
It's functionality that is very specific to a particular use case to be
added to a standard library module. Plus, it either needs to create new
atoms (which standard library will never do) or fail for some inputs (which
is again not generally useful):
iex(1)> m = %{key_1: :val_1, key_2: :val_2}
ie
The simplest alternative is to use :maps.filter(). It's not as easy to pipe
into, but that's a minor concern for me.
As another alternative, this should be faster and have lower memory
footprint than using Enum, although you'd need to benchmark it as well to
be sure:
map
|> Stream.filter(predicat
Mix does warn about it when you try to call a function from a non-existent
module:
$ mix compile
Compiling 1 file (.ex)
warning: function This.Module.Does.Not.Exist.foo/0 is undefined (module
This.Module.Does.Not.Exist is not available)
It does so because `mix xref` runs automatically on each com
The first advantage (write less code) is defeated by adding one more
function to the module, thereby increasing the API surface.
As for the second one, this code does one pass through the list:
Stream.map([1,2,3], & &1*2) |> Enum.sum
On Sat, Dec 1, 2018 at 6:19 PM Sean Handley wrote:
> Hello,
Questions like this should be asked on the Elixir Forum.
The problem with the expression `[x: 1, y: 2 | [z: 3]]` is that it is
parsed as `[x: 1, y: (2 | [z: 3])]`. As you may guess, the subexpression `2
| [z: 3]` does not make sense.
There's actually a working way to build the keyword list you wa
Hi,
We all love the ability to `use GenServer` in order to provide default
stubs for callback functions, saving us time and effort of writing the same
boilerplate over and over again.
However, I'm sure many of you have also been bitten by this very feature
where you made a typo in the signature o
The Elixir way is to use the pipe and `with` where each is more suitable
for the task. So if you need to write a sequence of function calls where
some or all are expected to return an error, `with` would be the most
appropriate tool to use.
One key difference between a pipeline and `with` is that
ExDoc already supports auto-linking for modules and functions inside the
docstring. See, for example,
http://elixir-lang.org/docs/stable/elixir/Enum.html#filter/2.
On Tue, Jul 19, 2016 at 1:41 AM, eksperimental
wrote:
> I have been craving for this feature for a long time.
> I think it will help
https://github.com/elixir-lang/elixir/issues/4957
On Thu, Jul 7, 2016 at 4:31 PM, José Valim
wrote:
> Accidental omission. Please open up an issue. :)
>
>
>
> *José Valim*
> www.plataformatec.com.br
> Skype: jv.ptec
> Founder and Director of R&D
>
> On Thu, Jul
Trying to compile the following piece of code
with :ok <- {:error, :foo} do
:ok
else
{:error, reason} when reason in [:foo, :bar] ->
:some_error
{:error, _} ->
:generic_error
end
results in this error
** (CompileError) iex:1: cannot invoke local when/2 inside match, called
as: {:e
Greg is right. In Elixir 1.3 it'll become possible to access map fields
when using get_in(). So the first code snippet from the original post may
become this
foo = get_in(Enum.find(list, &some_check/1), [Access.field(:bar)])
However, given the fact that OP uses both field access and Map.get, it'
18 matches
Mail list logo