Sign in

Father / Long Distance Walker / Erlanger @ NextRoll / Trainer @ EEF -

Another List-Related Asymmetry

A long time ago, I wrote an article about The Asymmetry of ++, thanks to Fede Bergero’s findings. Let’s add a few more asymmetries to that list…

Bridge Symmetry (by Andy Beecroft)

Note: This article is based on OTP23. Many things have been improved since that version already.


Initially, I thought about writing this article as a story (like I usually do), but I suddenly had too much information on my hands. So, I chose to start with a table/cheatsheet instead.

The goal of the table is to show how the different high-order functions in the lists module react when they’re given bad input, particularly…

The impressive Galician contributions to the Erlang Ecosystem

We all know about the most renowned Erlang/Elixir centers worldwide, like Sweden, Brazil, California, and London. But the community, even when not huge, is broadly spread. Today we want to celebrate a smaller region that’s home to many amazing contributions to our beloved ecosystem. The birthplace of my ancestors: Galicia!

The other shell that we love so much 🥰

So, in this unusual style (a collaborative bilingual interview-like article), we’re going to showcase 4 of the many Galicians that have had a profound impact on the language and the people around it…

Laura M. Castro

The erlang:process_info/1,2 version

This article is not meant to be an instructive one. It’s written just for fun! 🙃

Erlang is famous for its introspecting powers. You can get a lot of information about the processes running in your nodes without any external tool. One of the functions that provide that information is erlang:process_info/1,2.

Well, this article is not about it. It’s just about this unintuitive but understandable situation we found with Manuel Rubio and Mário Luís Guimarães on the Erlang Slack a long time ago…

1> Pid = spawn(fun() -> receive stop -> ok end end).
2> erlang:process_info(Pid) == erlang:process_info(Pid).

…or is it to Erlang Pattern-Matching?

Working as a mentor in the Education Working Group at The EEF, there are several tiny simple lessons that I’ve delivered over and over again. The one in this article is so common that I already gave it a name: The Robot Butt Rule.

Hey, girl! 😏

The rule goes like this…

To find if a list is not empty, don’t check its length. Use the robot butt instead.


Thanks to Filipe Varjão on Twitter, you can just skip this whole article.

Or how to use Pattern-Matching for Tests

While acting as a mentor on the FutureLearn MOOC about Erlang I presented an idea that folks like Adolfo Neto loved (he even tweeted about it 🧡). It is, in fact, the way I introduce people to pattern-matching when I’m teaching them Erlang. It’s a way to write tests that let you naturally work your code out from them… Sounds familiar? Yes! It’s Test-Driven Development!

Airplane! (1980)

The Process

I learned TDD when I learned Smalltalk. It was such a life-changing lesson! And Smalltalk was the best environment to learn it since it’s built for it. In Smalltalk, I believe it’s actually harder to…

So, I just watched Michał Muskała’s talk at CodeBEAMSF, and I have something to say…

Erlang is getting pretty!

As you might know, I’m also working with Juan Bono, Diego Calero, Facundo Olano, and others on our own formatter for Erlang (just like Daniel Tipping is working on steamroller). I could write an article on how our formatter differs from Michał’s but this time I want to focus our attention on a different topic.

Particularly I want to look at the following slide…

Formatters are more than Linters

Are Formatters “Linters on Steroids”?

Michał presents a concept in his talk that is somewhat widespread and I don’t think it’s correct…

Particularly for Erlang

Good Will Hunting (1997)

So, I Gusti Ngurah Oka Prinarjaya was reading Joe’s Book and he found one of the most amazing examples of List Comprehensions I’ve ever seen…

perms([]) -> [[]];
perms(List) -> [ [H|T] || H <- List, T <- perms(List--[H]) ].


1> lib_misc:perms("123").

And, of course… he couldn’t understand it. And, as a seasoned Erlang trainer, I got to tell you: He’s not alone… by any means. …

Let’s go back to the origins of this blog with a bit of unexpected code behavior. This time, let’s try removing elements from a list…

Maxwell Smart — because I couldn’t find any proper image for this article

Let’s Subtract!

The beauty of this trick is that the code examples work in both Erlang and Elixir, with barely any changes at all… I’ll do it in Elixir, feel free to try them out in Erlang or efene if you like.

Now, this is a list…

iex(1)> [1, 2, 3]
[1, 2, 3]

And now, we can subtract a few elements from it…

iex(2)> [1, 2, 3] -- [1, 2]

Let’s now subtract that last…

…or Why you should use specs if you use opaque types

Following the steps from Devon and Stavros, I wanted to write this article to highlight a not so obvious dialyzer lesson about opaque types and specs…

Help me help you — Jerry Maguire


For the impatient ones…

If you define an opaque type, you have to add specs to all the exported functions that use it (i.e. your module’s API).

Opaque Types

Since this article is about opaque types, I will do a quick intro first…

In Elixir, there are 3 ways to specify a user-defined type:

@type t1 :: boolean | atom # this type is exported
@typep t2 :: String.t …

…for Erlang & Elixir

A few months ago, Fred gave me a copy of his latest book (Property-Based Testing with PropEr, Erlang, and Elixir) so I could review it. So, here I am, returning the favor. But I’ll also use this chance to express some of my feelings and opinions about Property-Based Testing in general, since reading the book elicited quite a few of them. This will not be one of the usual articles on this blog, but I hope you’ll enjoy it anyway.

The Book

In a nutshell, this book is a very extensive and detailed manual/hands-on-tutorial with which you’ll first learn the general concepts…

Brujo Benavides

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