[erlang-questions] how: Another library flatten function?

Henning Diedrich <>
Fri Feb 26 16:43:20 CET 2010


Regex may come in handy. Could make it as easy as \W"\w and \w"\W.

Bengt Kleberg wrote:
> Easily change them, no. I would have to go over the list of lists and
> change them. But this is the best suggestion so far.
>
>
> bengt
>
> On Fri, 2010-02-26 at 15:27 +0100, Robert Raschke wrote:
>   
>> On Fri, Feb 26, 2010 at 1:58 PM, Bengt Kleberg
>> <> wrote:
>>         Greetings,
>>         
>>         I have the following list:
>>         ["asd",[["Flow","kalle"]],["Sub","F"]]
>>         I would like to flatten it to:
>>         ["asd","Flow","kalle","Sub","F"]
>>         lists:flatten/1 is too effective. It gives me:
>>         "asdFlowkalleSubF"
>>         
>>         Is there another flatten somewhere?
>>         
>>
>> I take it you couldn't easily change your strings to be binaries? 
>>
>> 1>
>> lists:flatten([<<"asd">>,[[<<"Flow">>,<<"kalle">>]],[<<"Sub">>,<<"F">>]]).
>> [<<"asd">>,<<"Flow">>,<<"kalle">>,<<"Sub">>,<<"F">>]
>>
>>
>> Robby
>>
>>
>>     
>
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:
>
>
>   



More information about the erlang-questions mailing list