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. 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.
  2. 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 https://gum.co/XgbKSE


This is the slide walkthrough of the talk I gave at Erlang & Elixir Bangalore meetup.

We use spawn, send, receive concepts from Elixir and a function loop to implement a GenServer.

GenServers expand to Generic Servers. What do we mean by servers here? Let’s consider a web server. We…


https://unsplash.com/photos/atSaEOeE8Nk

Elixir Task provides an abstraction over processes to perform long running jobs in parallel.

Let’s see first iteration.

Here we want to spawn a process and perform task in that process and collect back the result.

  1. We…


https://unsplash.com/photos/RCAhiGJsUUE

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.


https://unsplash.com/photos/OgvqXGL7XO4

Beware of converting any data type to atom dynamically, as atoms once created won’t be garbage collected.

We may not face this scenario often. But in scenarios where atoms are required, we might overlook this and convert dynamic values to atoms.

One such case is registering dynamic GenServer or Agent with a name.

Use {:global, term} or via_tuple to handle such scenarios appropriately.

More info at

https://hexdocs.pm/elixir/String.html#to_atom/1

https://hexdocs.pm/elixir/GenServer.html#module-name-registration


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

tl;dr

'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…


Final output

Project creation

In terminal use mix to create a new live view project without ecto.

mix phx.new chart --live --no-ecto

and press ‘y’ when asked to install dependency.

We are going to work on these following files.

  • lib > chart_web > live >…


Eligibility:

Am I eligible to comment? NO. Because it’s a belief system. And many people follow rigorous routine to do Sabarimala pilgrimage. I didn’t have the opportunity to do it. So I won’t have full understanding of the belief system.

And this should not be approached with 'sociological' or 'biological' logics…


Our brain always trys to abstract a piece of information. It will save space while storing and energy while retrieval. Because in-depth knowledge of all informations are not needed for survival. Only that those required are stored further, that too on repeated encounter.

Eg. Instead of, lions need us for food and will chase ,kill and eat us and that will be bad for my survival, it will be stored as ‘Avoid lions’.

This is boon.

Here comes the bane part.

Eg. Old diesel engines without catalytic converter releases more NOx and hence bad for environment. But what registered was ‘Diesel is bad’.

Because of development and knowledge, nowadays a word can alter the meaning. So it’s better to analyse(it’s hard to keep up with the information flow) before raising an opinion.


Throughout human history we tend to increase comfort. We started with food, then health and travel and all the physical comforts of life. We did the physical explorations and found ways to keep us comfortable.

In the mean time late in the game we started exploring metal comfortness. Recent technological advances try to keep us happier than ever before, by adjusting the contents we consume online and the medications we take, etc.

Two questions arise

  1. Similar to physical comfortness leading to obesity and we now realising the need for exercise, will we be realising that being always happy is not the ultimate human need?

Or the meaning of happiness be redefined in future?

Boobalan AP

Self referencing automaton

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store