[erlang-questions] Different result using io_lib:format under version 21, Is this expected?

Sölvi Páll Ásgeirsson solvip@REDACTED
Tue Jun 26 22:04:12 CEST 2018

Hi Chris

Both are legal return values from io_lib:format/2; it's defined such
that it might return deep lists.

I'd suggest that you flatten the output in your tests and don't rely
on a specific structure.
You can do that by using e.g. the built-in function iolist_to_binary/1
or lists:flatten/1.
However, you do not need to, and should not, flatten the list before
writing it to a file or a socket.

I've found that https://prog21.dadgum.com/70.html explains the concept
quite well.

Sölvi Páll Á.

On Tue, Jun 26, 2018 at 5:43 PM, chris casilli
<christopher.casilli@REDACTED> wrote:
> Hello,
> A few of my tests started failing when run under the newer versions 21.0.
> I wanted to ensure this is expected new behavior, before I modify my code to match new results:
> With the previous versions this was the result:
> io_lib:format(“~.16B”,[255]).
> [“FF”]
> This is the current result under the new version 21.0 & 20.0.1
> io_lib:format(“~.16B”,[255]).
> “FF”
> Please let me know if this is expected and the new expected result.
> Kind Regards,
> Chris Casilli
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

More information about the erlang-questions mailing list