lists:concat/1
合并为一个文本形式的列表
用法:
concat(Things) -> string()
内部实现:
%% concat(L) concatenate the list representation of the elements
%% in L - the elements in L can be atoms, numbers of strings.
%% Returns a list of characters.
-spec concat(Things) -> string() when
Things :: [Thing],
Thing :: atom() | integer() | float() | string().
concat(List) ->
flatmap(fun thing_to_list/1, List).
thing_to_list(X) when is_integer(X) -> integer_to_list(X);
thing_to_list(X) when is_float(X) -> float_to_list(X);
thing_to_list(X) when is_atom(X) -> atom_to_list(X);
thing_to_list(X) when is_list(X) -> X. %Assumed to be a string
把列表 Things 里的每个元素合并成一个文本字符表示的新列表,列表 Things 里的元素可以是原子,整数,浮点数,字符串
lists:concat(['/erlang/R', 16, "B/lib/erlang/lib/stdlib", "-", "1.19.1/src/lists", '.', erl]).