<div dir="ltr"><div>The problem is not evaluation</div><div><br></div><div>1> io:format("~B~n", [20 * 20]).</div><div>400</div><div>ok</div><div><br></div><div>You got error because result of 20*20 is integer and ~f expect float. The expression was already evaluated as you can see in</div>
<div> called as io:format(<0.26.0>,"~f~n",[400])</div><div>in your error message.</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 6, 2014 at 12:35 AM, Yves S. Garret <span dir="ltr"><<a href="mailto:yoursurrogategod@gmail.com" target="_blank">yoursurrogategod@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr">Hello,<div><br></div><div>Recently I tried the following:</div><div><br></div><div><div>82> io:format("~s~n", [os:cmd("ls -l")]). </div><div>total 12</div><div>-rw-r--r-- 1 dai users 2692 Jan 5 18:28 input_output.beam</div>
<div>-rw-r--r-- 1 dai users 4581 Jan 5 18:28 input_output.erl</div><div><br></div><div>ok</div><div>83> io:format("~f~n", [20 * 20]). </div><div>** exception error: bad argument</div><div> in function io:format/3</div>
<div> called as io:format(<0.26.0>,"~f~n",[400])</div></div><div><br></div><div>It struck me as a little odd that while I can execute system functions in a list (right before printing to console), but not system operations. Am I missing something? When can you do one, but not the other? Or have I simply misunderstood something?</div>
</div>
<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br></div></div>