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

Robert Raschke <>
Fri Feb 26 15:27:20 CET 2010


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


More information about the erlang-questions mailing list