Skip to content

Instantly share code, notes, and snippets.

@knewter
Created May 21, 2014 02:46
Show Gist options
  • Save knewter/b1b5de17a7fb93d84509 to your computer and use it in GitHub Desktop.
Save knewter/b1b5de17a7fb93d84509 to your computer and use it in GitHub Desktop.
iex(1)> increment = &Map.update!(&1, :count, fn(x) -> x + 1 end)
#Function<6.106461118/1 in :erl_eval.expr/5>
iex(2)> increment = fn(x) -> x[:count] = x[:count] + 1 end
** (ArgumentError) dynamic access cannot be invoked inside match and guard clauses
(elixir) expanding macro: Kernel.access/2
(elixir) iex:2: :elixir_compiler.__FILE__/2
iex(2)>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment