Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Haskell RecordDotSyntax language extension proposal (Accepted). Parent comment
%{existing_map_or_struct | some_key_1: :some_val, some_key_2: :some_val}
some_val |> put_in([:foo, :bar, :baz], 3) some_val |> update_in([:foo, :bar, :baz], fn x -> x + 1 end)
put_in(foo.bar.baz, 2) update_in(foo[:some]["nested"][:path], & &1 + 1)
iex(1)> foo = %{bar: %{baz: 2}} %{bar: %{baz: 2}} iex(2)> update_in(foo.bar.baz, & &1 + 1) %{bar: %{baz: 3}}
https://hexdocs.pm/elixir/master/Kernel.html#put_in/2
https://hexdocs.pm/elixir/master/Kernel.html#put_in/3
https://hexdocs.pm/elixir/master/Kernel.html#update_in/2
https://hexdocs.pm/elixir/master/Kernel.html#update_in/3
There are no comments on this comment yet.
https://hexdocs.pm/elixir/master/Kernel.html#put_in/2
https://hexdocs.pm/elixir/master/Kernel.html#put_in/3
https://hexdocs.pm/elixir/master/Kernel.html#update_in/2
https://hexdocs.pm/elixir/master/Kernel.html#update_in/3