List questions

Craig Dickson crd@REDACTED
Thu Sep 9 23:15:39 CEST 1999


Since Erlang has no separate type for text characters, a text string is just
a list of integers. Because of this, it has no sure way of knowing whether
any arbitrary list of integers is meant to be a text string, so when
displaying them, it guesses. Your lists below are composed entirely of
integers that correspond to printable ASCII characters, so it figures they
might be meant to be strings, and displays them as such. (The actual
criterion may be a bit different; I haven't looked at the code. But I
believe that's the basic idea.)

Craig

----- Original Message -----
From: Mickael Remond <mikl@REDACTED>
To: <erlang-questions@REDACTED>
Sent: Thursday, 9 September 1999 10:35 pm
Subject: List questions


>
> I was very surprised with the result of the following commands :
>
> 19> [40].
> "("
> 20> [45].
> "-"
> 21> [60].
> "<"
> 22> [80].
> "P"
>
>
> In fact, the result is displayed as a character corresponding to the
> ascii code in the list.
>
> This is quite surprising at first. In a complex command I search for a
> bug because the function was not supposed to return strings.
>
> I guess this has no consequence on the program logic, but you must be
> very careful to avoid be trapped by what you see.
>
>
> Have funs->
>
> --
> Mickael Remond
> mikl@REDACTED
> ICQ : 2265396
>




More information about the erlang-questions mailing list