Last active
March 4, 2016 13:29
-
-
Save mrkaspa/9c67685eb8bd5da63a77 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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