2011-12-27 8 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

+0

リンクは404です。おそらく、現在の場所はhttp://erlang.org/doc/man/erlang.html#binary_to_list-1です –

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">>]). 
関連する問題