Skip to content

Instantly share code, notes, and snippets.

@chipairon
Created September 12, 2015 14:38
Show Gist options
  • Save chipairon/21b017eff7898c749691 to your computer and use it in GitHub Desktop.
Save chipairon/21b017eff7898c749691 to your computer and use it in GitHub Desktop.
defmodule Crasher do
def start do
{:ok, _agent} = Agent.start_link
fn -> %{aa: 1, bb: 2, cc: 0, dd: 3} end,
name: :crasher_agent
end
def show do
Agent.get :crasher_agent, fn x -> x end
end
def crash do
Agent.get :crasher_agent, fn dict ->
Enum.map dict, fn {key, value} -> {key, 10 / value} end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment