2011-12-27 68 views

回答

8

[binary_to_list(X) || X <- [<<"a">>, <<"b">>, <<"c">>]].或更復雜的

 
BinList = [<<"a">>, <<"b">>, <<"c">>], 
NormalList = [binary_to_list(X) || X <- BinList], 
NormalList. 

+1

鏈接binary_to_list實況:HTTP:/ /erldocs.com/R15B/erts/erlang.html?i=3#binary_to_list/1。 – kay 2011-12-30 10:40:33

+0

鏈接提供了404鏈接。推測這是當前位置http://erlang.org/doc/man/erlang.html#binary_to_list-1 – 2016-10-18 22:29:34

2

,你可以做這樣的:

A=[<<"a">>, <<"b">>, <<"c">>] 
B=[binary_to_list(Item) || Item <- A] 
5

或者,使用列表:映射/ 2:

lists:map(fun erlang:binary_to_list/1, [<<"a">>, <<"b">>, <<"c">>]).