[erlang-questions] Lists!!

Chris Hicks <>
Mon Sep 19 17:39:00 CEST 2011


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
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110919/ed4465f1/attachment.html>


More information about the erlang-questions mailing list