Skip to content

Commit aeea645

Browse files
nfpichejosevalim
nfpiche
authored andcommitted
Update agent.markdown (elixir-lang#767)
Looks like two different explanations of step were left, I left the one I felt was a better descriptor of what was going on. One thing I wasn't sure about was that even though we are calling Agent.stop with only one argument, the function itself has an arity of three so I thought it would be better to have that represented over Agent.stop/1
1 parent 5603f65 commit aeea645

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

getting-started/mix-otp/agent.markdown

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ iex> Agent.stop(agent)
4848
:ok
4949
```
5050

51-
We started an agent with an initial state of an empty list. We updated the agent's state, adding our new item to the head of the list. The second argument of [`Agent.update/3`](/docs/stable/elixir/Agent.html#update/3) is a function that takes the agent's current state as input and returns its desired new state. Finally, we retrieved the whole list. The second argument of [`Agent.get/3`](/docs/stable/elixir/Agent.html#get/3) is a function that takes the state as input and returns the value that `Agent.get/3` itself will return. Once we are done with the agent, we can call `Agent.stop/1` to terminate the agent process.
51+
We started an agent with an initial state of an empty list. We updated the agent's state, adding our new item to the head of the list. The second argument of [`Agent.update/3`](/docs/stable/elixir/Agent.html#update/3) is a function that takes the agent's current state as input and returns its desired new state. Finally, we retrieved the whole list. The second argument of [`Agent.get/3`](/docs/stable/elixir/Agent.html#get/3) is a function that takes the state as input and returns the value that [`Agent.get/3`](/docs/stable/elixir/Agent.html#get/3) itself will return. Once we are done with the agent, we can call [`Agent.stop/3`](/docs/stable/elixir/Agent.html#stop/3) to terminate the agent process.
5252

5353
Let's implement our `KV.Bucket` using agents. But before starting the implementation, let's first write some tests. Create a file at `test/kv/bucket_test.exs` (remember the `.exs` extension) with the following:
5454

0 commit comments

Comments
 (0)