Skip to content

Instantly share code, notes, and snippets.

@GusGA
Created July 31, 2018 03:06
Show Gist options
  • Save GusGA/2651d07caca22887a34574e5845d5d5d to your computer and use it in GitHub Desktop.
Save GusGA/2651d07caca22887a34574e5845d5d5d to your computer and use it in GitHub Desktop.
flatten array
-module(flatten).
-export([flat/1]).
flat(List) -> flat(List, []).
flat([], Acc) -> Acc;
flat([H | T], Acc) -> flat(H, flat(T, Acc));
flat(H, Acc) -> [H | Acc].
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment