Skip to main content

Hi, I'm Mariano Guerra, below is my blog, if you want to learn more about me and what I do check a summary here: marianoguerra.github.io or find me on twitter @warianoguerra or Mastodon @marianoguerra@hachyderm.io

strings are lists :S

me llevo un rato encontrar este bug


2> lists:suffix(".fn", io_lib:format("~p-~p-~p.~s", [1,2,3,"fn"])).
false
3> lists:suffix(".fn", lists:flatten(io_lib:format("~p-~p-~p.~s", [1,2,3,"fn"]))).
true


la razon es que


1> io_lib:format("~p-~p-~p.~s", [1,2,3,"fn"]).
["1",45,"2",45,"3",46,"fn"]


y no lo que uno esperaria


4> lists:flatten(io_lib:format("~p-~p-~p.~s", [1,2,3,"fn"])).
"1-2-3.fn"