Skip to content

Instantly share code, notes, and snippets.

@mrkaspa
Last active March 4, 2016 13:29
Show Gist options
  • Save mrkaspa/9c67685eb8bd5da63a77 to your computer and use it in GitHub Desktop.
Save mrkaspa/9c67685eb8bd5da63a77 to your computer and use it in GitHub Desktop.
#creating
{:ok, pid} = Agent.start_link(fn -> [] end)
#getting state
Agent.get(pid, fn(arr) -> arr end)
#updating state
Agent.get(pid, fn(arr) -> [1 | arr] end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment