Erlang Mailing Lists

Author Message

<  Erlang questions mailing list  ~  Lists!!

Guest
Posted: Mon Sep 19, 2011 3:32 pm Reply with quote
Guest
Hey Everyone,
Here is the question:
Guest
Posted: Mon Sep 19, 2011 3:33 pm Reply with quote
Guest
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 <amir_fire_2005@yahoo.com> 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
> erlang-questions@erlang.org
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
_______________________________________________
erlang-questions mailing list
erlang-questions@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions

Post received from mailinglist
Guest
Posted: Mon Sep 19, 2011 3:39 pm Reply with quote
Guest
If you are trying to print the list, take a look at the options for the io:format/1
Guest
Posted: Mon Sep 19, 2011 3:44 pm Reply with quote
Guest
No I am not trying to print them.
daleharvey
Posted: Mon Sep 19, 2011 3:46 pm Reply with quote
User Joined: 14 Sep 2007 Posts: 18
> "\b" =:= [8].
true

they are exactly the same thing, just different ways to display

On 19 September 2011 16:44, Amir <amir_fire_2005@yahoo.com (amir_fire_2005@yahoo.com)> wrote:
Quote:




No I am not trying to print them.
View user's profile Send private message
Guest
Posted: Mon Sep 19, 2011 3:47 pm Reply with quote
Guest
Thanks all...








----- Forwarded Message -----
From: Dale Harvey <dale@arandomurl.com>
To: Amir <amir_fire_2005@yahoo.com>
Cc: "erlang-questions@erlang.org" <erlang-questions@erlang.org>
Sent: Monday, September 19, 2011 5:46 PM
Subject: Re: [erlang-questions] Fw: Lists!!

> "\b" =:= [8].
true

they are exactly the same thing, just different ways to display

On 19 September 2011 16:44, Amir <amir_fire_2005@yahoo.com (amir_fire_2005@yahoo.com)> wrote:
Quote:




No I am not trying to print them.
Guest
Posted: Mon Sep 19, 2011 3:50 pm Reply with quote
Guest
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: amir_fire_2005@yahoo.com
To: erlang-questions@erlang.org
Subject: [erlang-questions] Fw: Lists!!





No I am not trying to print them.
Guest
Posted: Tue Sep 20, 2011 2:26 am Reply with quote
Guest
On 20/09/2011, at 3: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 ?

That *IS* the original list.


_______________________________________________
erlang-questions mailing list
erlang-questions@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions
Post received from mailinglist
Guest
Posted: Tue Sep 20, 2011 2:28 am Reply with quote
Guest
On 20/09/2011, at 3:44 AM, Amir wrote:

>
>
> 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"

[8] and "\b" are the SAME THING, as a quick

> [8] = "\b".

would have shown you. This is all in the documentation and
the textbooks; they do repay reading.


_______________________________________________
erlang-questions mailing list
erlang-questions@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions
Post received from mailinglist

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum