Skip to content

Instantly share code, notes, and snippets.

@nsomar
Created April 23, 2017 19:05
Show Gist options
  • Select an option

  • Save nsomar/3165e81b8b878828cba9271eb2f01a10 to your computer and use it in GitHub Desktop.

Select an option

Save nsomar/3165e81b8b878828cba9271eb2f01a10 to your computer and use it in GitHub Desktop.
# Creating
Agent.start_link(fn -> [0] end, name: Storage)
# Update
Agent.update(Storage, fn state -> state ++ [1] end)
Agent.update(Storage, fn state -> state ++ [2] end)
# Retreive
Agent.get(Storage, fn state -> state end) |> IO.inspect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment