Skip to content

Instantly share code, notes, and snippets.

@masayuki038
Last active December 19, 2015 17:19
Show Gist options
  • Save masayuki038/5990779 to your computer and use it in GitHub Desktop.
Save masayuki038/5990779 to your computer and use it in GitHub Desktop.
-moudle(tuple_to_list_recursively).
-export([tuple_to_list_recursively/1]).
tuple_to_list_recursively({}) -> [];
tuple_to_list_recursively([]) -> [];
tuple_to_list_recursively(T) when is_tuple(T) ->
tuple_to_list_recursively(tuple_to_list(T));
tuple_to_list_recursively(T) when is_list(T) ->
[H|L] = T,
lists:concat([tuple_to_list_recursively(H), tuple_to_list_recursively(L)]);
tuple_to_list_recursively(T) ->
T.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment