What is the difference between [string ()] and list () in erlang?

Erlang: what is the difference between [string ()] and list () ??

I saw them as return types ct_telnet: cmd and ct_ssh: exec?

http://erlang.org/doc/man/ct_ssh.html

exec(SSH, Command, Timeout) -> {ok, Data} | {error, Reason}
Types:
  Data = list()

http://erlang.org/doc/man/ct_telnet.html

cmd(Connection, Cmd, Opts) -> {ok, Data} | {error, Reason}
Types:
  Data = [string()]
+3
source share
1 answer

Type list()denotes any list without specifying the type of its elements. Another way to spell this is: [_]or [term()].

A string()is a special case list(): this is a list containing integers representing Unicode code points (either Latin-1 characters if less than 256, or ASCII characters if there are less than 128). Another way to write string()is list(char())or [char()].

A [string()] - . list(string()). , ( ), list().

+8

All Articles