此问题与Enum.reverse/1
函数没有直接关系。你可以通过传递整数的列表IO.write/1
重现同样的事情:
iex(5)> IO.write([8,7,6,5,4,3,2,1])
^H^G^F^E^D^C^B^A:ok
这里发生的事情是,IO.write/1
正在接收整数的列表,并把它作为“字符列表”。使用单引号时可以创建char列表,如'foo'
。使用给了我们很多的细节:
iex(22)> i('foo')
Term
'foo'
Data type
List
Description
This is a list of integers that is printed as a sequence of characters
delimited by single quotes because all the integers in it represent valid
ASCII characters. Conventionally, such lists of integers are referred to as
"char lists" (more precisely, a char list is a list of Unicode codepoints,
and ASCII is a subset of Unicode).
Raw representation
[102, 111, 111]
Reference modules
List
我想,这些字符是由这将导致声音效果和“笑脸”窗口古怪的解释。
编辑:入门文档也是非常有用的:http://elixir-lang.org/getting-started/binaries-strings-and-char-lists.html#utf-8-and-unicode
不是为了你的利益@MakeWebSocketsGreatAgain但对于其他人的利益谁可能会发现这样一个问题:https://github.com/elixir-lang/elixir/wiki/FAQ(项目4)。 –