digraph edges and improper lists

Fred Youhanaie fly@REDACTED
Mon Dec 20 17:22:43 CET 2021


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?


More information about the erlang-questions mailing list