I work on some Erlang tutorials and notice when I enter
[8].
VM returns "\ b" or if I type
[9].
VM returns "\ t"
I am confused why this is happening. Other numbers are returned as a list of this number:
[3].
returns as [3]
[4].
returns as [4] etc.
I think the question is why erlang VM returns it this way? Perhaps an explanation of the list [65] and the list? "A".Another related element is also confused: Type conversion, conversion of a list to an integer is performed as follows:
list_to_integer("3").
Not
list_to_integer([3]).
What error returns
Erlang . - . , , , .
1> [72, 101, 108, 108, 111]. "Hello"
, , .
2> [72, 101, 108, 108, 111, 1]. [72,101,108,108,111,1]
Erlang - , - .
[97,98,99].
"abc"
", !", , (C) 2013, " ". . 18.
Erlang: string. - , . ?- :
3> [97,98,99,4,5,6]. [97,98,99,4,5,6] 4> [233]. "é"
Erlang , . Erlang , !
", !" : http://learnyousomeerlang.com/
Kadaj answered your first question. As for the second question list_to_integer, if you look at the documentation , the majority of list_to_XXXfunctions, in addition to binary, bitstringand tupleview them as a string argument. Calling them string_to_XXXmay be clearer, but changing the name will break a lot of code.
list_to_integer
list_to_XXX
binary
bitstring
tuple
string_to_XXX