<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'><div dir='ltr'>
That is correct. Internally the result of the function is stored as [8]. You are simply seeing the shell's assumption of what [8] means. I'm not in a place to open an erlang shell so I'll show you how to provie it to yourself with a series of commands:<div><br></div><div>[8] <-- Shows you "\b' as you said</div><div><br></div><div>so do:</div><div><br></div><div>[N] = [8].</div><div><br></div><div>Then:</div><div><br></div><div>N * 4. <-- You will get a result of 32</div><div><div><br><div><hr id="stopSpelling">Date: Mon, 19 Sep 2011 08:44:33 -0700<br>From: amir_fire_2005@yahoo.com<br>To: erlang-questions@erlang.org<br>Subject: [erlang-questions] Fw: Lists!!<br><br><div style="color:#000;background-color:#fff;font-family:arial, helvetica, sans-serif;font-size:12pt"><div><span><br></span></div><div><br></div><div style="font-size:12pt;font-family:arial, helvetica, sans-serif"><div style="font-size:12pt;font-family:'times new roman', 'new york', times, serif"><div id="ecxyiv631912451"><div style="color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);font-size:12pt;font-family:arial, helvetica, sans-serif"><div style="font-size:12pt;font-family:arial, helvetica, sans-serif"><span>No I am not trying to print them. </span></div><div style="font-family:arial, helvetica, sans-serif;font-size:12pt" class="ecxyui_3_2_0_19_131644619604863"><span>I want the function to return the list containing a number </span></div><div style="font-size:12pt;font-family:arial, helvetica, sans-serif"><span><br></span></div><div style="font-size:12pt;font-family:arial, helvetica, sans-serif"><span>The r</span><span>equirement says:</span></div><div style="font-size:12pt;font-family:arial, helvetica, sans-serif"><br></div><div style="font-size:12pt;font-family:arial, helvetica, sans-serif">the function should return [Number]</div><div style="font-size:12pt;font-family:arial, helvetica, sans-serif">For example [8] but the shell shows me "\b"</div><div style="font-size:12pt;font-family:arial, helvetica, sans-serif"><br></div><div><font class="ecxyiv631912451Apple-style-span" size="3">As a result of </font>previous replied<font class="ecxyiv631912451Apple-style-span" size="3">, when the function returns "\b" instead of [8], I should imagine the requirement is covered, but it just shows that way?</font></div><div><font class="ecxyiv631912451Apple-style-span" size="3"><br></font></div><div><font class="ecxyiv631912451Apple-style-span" size="3"><br></font></div><div><font class="ecxyiv631912451Apple-style-span" size="3"><br></font></div><div><font class="ecxyiv631912451Apple-style-span" size="3">---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------</font></div><div><font class="ecxyiv631912451Apple-style-span" size="3"><br></font></div><div><font class="ecxyiv631912451Apple-style-span" size="3"><span class="ecxApple-style-span" style="font-family:'Times New Roman'"><div style="background-color:rgb(255, 255, 255);color:rgb(0, 0, 0);padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;margin-right:0px;margin-bottom:0px;margin-left:12px;font-family:arial, helvetica, sans-serif;display:block;font-size:12pt"><div><br></div><div class="ecxyui_3_2_0_18_131644619604852" style="font-family:arial,\00000d\00000a helvetica, sans-serif;font-size:12pt"><div class="ecxyui_3_2_0_18_131644619604857" style="font-family:'times new roman', 'new york', times, serif;font-size:12pt"><font size="2" face="Arial">----- Forwarded Message -----<br><b><span style="font-weight:bold">From:</span></b> Chris Hicks <silent_vendetta@hotmail.com><br><b><span style="font-weight:bold">To:</span></b> bob@redivi.com; amir_fire_2005@yahoo.com<br><b><span style="font-weight:bold">Cc:</span></b> erlang-questions@erlang.org<br><b><span style="font-weight:bold">Sent:</span></b> Monday, September 19, 2011 5:39 PM<br><b><span style="font-weight:bold">Subject:</span></b> RE: [erlang-questions] Lists!!<br></font><br><div id="ecxyiv313848332"><div dir="ltr">If you are trying to print the list, take a look at the options for the <a rel="nofollow" href="http://erldocs.com/R14B03/stdlib/io.html?i=2&search=io:for#format/1" target="_blank">io:format/1</a> module. If you are going to be performing mathematical calculations on the different items in the list, the Erlang system will automatically treat them as numbers, because that's what they are. The issue you are seeing is due to the fact that there is no string type in Erlang, simply lists of ASCII codes corresponding to the characters and the shell makes the assumption that you have input a string, in this case. It is just a formatting issue, not a change of the underlying structure.<br><br><div>> Date: Mon, 19 Sep 2011 08:33:51 -0700<br>> From: bob@redivi.com<br>> To: amir_fire_2005@yahoo.com<br>> CC: erlang-questions@erlang.org<br>> Subject: Re: [erlang-questions] Lists!!<br>> <br>> These lists are indistinguishable, this is just how the shell displays<br>> lists that could be interpreted as strings. "abc" =:=
[97,98.99].<br>> <br>> On Mon, Sep 19, 2011 at 8:32 AM, Amir <amir_fire_2005@yahoo.com> wrote:<br>> ><br>> ><br>> > Hey Everyone,<br>> > Here is the question:<br>> > If you try to enter this on Erlang shell [97,98,99].<br>> > you will get the following answer: "abc"<br>> > But I need the original list to be returned, is there any solution ?<br>> > By the way,<br>> > init:script_id().<br>> > {"OTP APN 181 01","R14B03"}<br>> ><br>> ><br>> ><br>> > _______________________________________________<br>> > erlang-questions mailing list<br>> > erlang-questions@erlang.org<br>> > http://erlang.org/mailman/listinfo/erlang-questions<br>> ><br>> ><br>> _______________________________________________<br>> erlang-questions mailing list<br>> erlang-questions@erlang.org<br>>
http://erlang.org/mailman/listinfo/erlang-questions<br></div></div></div><br></div><div class="ecxyui_3_2_0_18_131644619604857" style="font-family:'times new roman', 'new york', times, serif;font-size:12pt"><br></div><div class="ecxyui_3_2_0_18_131644619604857" style="font-family:'times new roman', 'new york', times, serif;font-size:12pt"><br></div><div class="ecxyui_3_2_0_18_131644619604857" style="font-family:'times new roman', 'new york', times, serif;font-size:12pt"><br></div></div></div></span></font></div><div style="font-size:12pt;font-family:arial, helvetica, sans-serif"><div style="font-size:12pt;font-family:times, serif"><font size="2" face="Arial"><hr size="1"><b><span style="font-weight:bold">From:</span></b> Bob Ippolito <bob@redivi.com><br><b><span style="font-weight:bold">To:</span></b> Amir <amir_fire_2005@yahoo.com><br><b><span style="font-weight:bold">Cc:</span></b> "erlang-questions@erlang.org"
<erlang-questions@erlang.org><br><b><span style="font-weight:bold">Sent:</span></b> Monday, September 19, 2011 5:33 PM<br><b><span style="font-weight:bold">Subject:</span></b> Re: [erlang-questions] Lists!!<br></font><br>These lists
are indistinguishable, this is just how the shell displays<br>lists that could be interpreted as strings. "abc" =:= [97,98.99].<br><br>On Mon, Sep 19, 2011 at 8:32 AM, Amir <<a rel="nofollow" href="mailto:amir_fire_2005@yahoo.com">amir_fire_2005@yahoo.com</a>> wrote:<br>><br>><br>> Hey Everyone,<br>> Here is the question:<br>> If you try to enter this on Erlang shell [97,98,99].<br>> you will get the following answer: "abc"<br>> But I need the original list to be returned, is there any solution ?<br>> By the way,<br>> init:script_id().<br>> {"OTP APN 181 01","R14B03"}<br>><br>><br>><br>> _______________________________________________<br>> erlang-questions mailing list<br>> <a rel="nofollow" href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>>
<a rel="nofollow" href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>><br>><br><br><br></div></div></div></div><br><br></div></div></div><br>_______________________________________________
erlang-questions mailing list
erlang-questions@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions</div></div></div> </div></body>
</html>