[erlang-questions] Fw: Lists!!

Chris Hicks <>
Mon Sep 19 17:50:15 CEST 2011


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:
[8] <-- Shows you "\b' as you said
so do:
[N] = [8].
Then:
N * 4. <-- You will get a result of 32
Date: Mon, 19 Sep 2011 08:44:33 -0700
From: 
To: 
Subject: [erlang-questions] Fw:  Lists!!



No I am not trying to print them. I want the function to return the list containing a number 
The requirement says:
the function should return        [Number]For example     [8]        but the shell shows me "\b"
As a result of previous replied, when the function returns "\b" instead of [8], I should imagine the requirement is covered, but it just shows that way?


---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

----- Forwarded Message -----
From: Chris Hicks <>
To: ; 
Cc: 
Sent: Monday, September 19, 2011 5:39 PM
Subject: RE: [erlang-questions] Lists!!

If you are trying to print the list, take a look at the options for the io:format/1 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.

> Date: Mon, 19 Sep 2011 08:33:51 -0700
> From: 
> To: 
> CC: 
> Subject: Re: [erlang-questions] Lists!!
> 
> These lists are indistinguishable, this is just how the shell displays
> lists that could be interpreted as strings. "abc" =:=
 [97,98.99].
> 
> On Mon, Sep 19, 2011 at 8:32 AM, Amir <> wrote:
> >
> >
> > Hey Everyone,
> > Here is the question:
> > If you try to enter this on Erlang shell [97,98,99].
> > you will get the following answer: "abc"
> > But I need the original list to be returned, is there any solution ?
> > By the way,
> > init:script_id().
> > {"OTP  APN 181 01","R14B03"}
> >
> >
> >
> > _______________________________________________
> > erlang-questions mailing list
> > 
> > http://erlang.org/mailman/listinfo/erlang-questions
> >
> >
> _______________________________________________
> erlang-questions mailing list
> 
>
 http://erlang.org/mailman/listinfo/erlang-questions




From: Bob Ippolito <>
To: Amir <>
Cc: ""
 <>
Sent: Monday, September 19, 2011 5:33 PM
Subject: Re: [erlang-questions] Lists!!

These lists
 are indistinguishable, this is just how the shell displays
lists that could be interpreted as strings. "abc" =:= [97,98.99].

On Mon, Sep 19, 2011 at 8:32 AM, Amir <> wrote:
>
>
> Hey Everyone,
> Here is the question:
> If you try to enter this on Erlang shell [97,98,99].
> you will get the following answer: "abc"
> But I need the original list to be returned, is there any solution ?
> By the way,
> init:script_id().
> {"OTP  APN 181 01","R14B03"}
>
>
>
> _______________________________________________
> erlang-questions mailing list
> 
>
 http://erlang.org/mailman/listinfo/erlang-questions
>
>





_______________________________________________
erlang-questions mailing list

http://erlang.org/mailman/listinfo/erlang-questions 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110919/a9807c3f/attachment.html>


More information about the erlang-questions mailing list