| Author |
Message |
|
| Guest |
Posted: Mon Sep 19, 2011 3:32 pm |
|
|
|
Guest
|
Hey Everyone,
Here is the question: |
|
|
| Back to top |
|
| Guest |
Posted: Mon Sep 19, 2011 3:33 pm |
|
|
|
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 |
|
|
| Back to top |
|
| Guest |
Posted: Mon Sep 19, 2011 3:39 pm |
|
|
|
Guest
|
| If you are trying to print the list, take a look at the options for the io:format/1 |
|
|
| Back to top |
|
| Guest |
Posted: Mon Sep 19, 2011 3:44 pm |
|
|
|
Guest
|
| No I am not trying to print them. |
|
|
| Back to top |
|
| daleharvey |
Posted: Mon Sep 19, 2011 3:46 pm |
|
|
|
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. |
|
|
| Back to top |
|
| Guest |
Posted: Mon Sep 19, 2011 3:47 pm |
|
|
|
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. |
|
|
| Back to top |
|
| Guest |
Posted: Mon Sep 19, 2011 3:50 pm |
|
|
|
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. |
|
|
| Back to top |
|
| Guest |
Posted: Tue Sep 20, 2011 2:26 am |
|
|
|
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 |
|
|
| Back to top |
|
| Guest |
Posted: Tue Sep 20, 2011 2:28 am |
|
|
|
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 |
|
|
| Back to top |
|
|
|