cri.dev
about posts rss

cons

Published on

cons is used to “construct” a new object, based on two values.

the parts are called cons pairs, cons cells etc.

More info here: https://en.wikipedia.org/wiki/Cons

https://dorgan.ar/posts/2021/03/making-sense-of-elixir-(improper)-lists/

Came across the term in the past, but never dug into it. Just recently I started reading “The little Elixir and OTP Guidebook” and that’s were I got a better grasp of the term and usage, e.g. [1 | 2] the | represents the cons operator. In elixir it can be used for constructing, destructuring and pattern matching (e.g. in lists, but not only).

Here, have a slice of pizza 🍕