Elixir learnings - 2020 week 5

2020/01/27

Elixir

Map.get defaults

Something small, but I realized that you can pass in a default to Map.get in case the key you're looking for doesn't exist.

Enum.reduce_while

I also discovered that you can use reduce_while which allows you to reduce on an enumerable collection until a criteria is met.

Modules

Automatic node discovery

My current place of work is using peerage for automatic erlang node discovery in k8s. This library makes it possible to have multiple k8s nodes that are sharing a network to automatically discover each other and connect. See also libcluster and horde for similar automatic node discovery libraries.

Sources

  1. Map.get
  2. Enum.reduce_while