Boobalan AP

Agent is an abstraction over GenServer. It is used when we want to store and retrieve only the data from the process without doing any additional logic.

  1. On start we initialize the state. We pass a function and the return value of it is assigned to the initial state.
  2. If we want to retrieve the state, we pass a function which takes state as parameter and manipulates it to return back what and how we want.
  3. If we want to update the state, again a function is passed which takes parameter as list and the return value of the function is assigned to the state.

Check my book for Elixir starters at



How long can we stare at a picture? 1hour? I don’t know.

This pandemic has made us stare pictures of our house and monitor for the longest time.

We miss the commute, office space, lifts, meeting rooms, pantry, food courts, restaurants, weekend trips etc. We miss these ever changing pictures.



A laptop and a mounted television.
Not related to the article. Just added to make thumbnail look good ;)


'in' is usually used with list or range. But here we

1. Implement Enumerable for another data type to use ‘in’.

2. Define macro with ‘in’ to improve readability.

Don’t try this at home

Just kidding, we can use this, but we might introduce unnecessary bugs in the code and might make the code unreadable…