digraph edges and improper lists

Fred Youhanaie <[email protected]> Mon, 20 Dec 2021 16:22:43 +0000
Newsgroups gmane.comp.lang.erlang.general
Message-ID <[email protected]>
Hi

The digraph module uses the term ['$e'|N] to represent an edge.

Is there an advantage in using an improper list, as opposed to the more intuitive tuple format {'$e', N}?

I recently came across a situation where the following crashed because logger tried to flatten the list of improper lists!

logger:notice(#{ edges => digraph:edges(G) }).

However, these two were OK:

logger:notice(#{ edges => { digraph:edges(G) } }). %% Note the extra braces
logger:notice("edges = ~w", [digraph:edges(G)] ).

For me this was a temporary annoyance, but I'm just curious about the choice of list structure. Is this explained anywhere, such as docs or a blog?

Cheers,
Fred