Skip to content

Instantly share code, notes, and snippets.

View jordi-chacon's full-sized avatar

Jordi Chacón jordi-chacon

  • Distru
  • Barcelona
View GitHub Profile
{
"version": "1.0.0-*",
"webroot": "wwwroot",
"exclude": [
"wwwroot"
],
"packExclude": [
"**.kproj",
"**.user",
"**.vspscc"
@jordi-chacon
jordi-chacon / flatten.ex
Last active January 19, 2019 23:48
Elixir function that flattens an array of integers without using List.flatten
defmodule M do
def flatten(l) do
flatten(l, [])
|> Enum.reverse
end
def flatten([], acc) do
acc
end
def flatten([head | tail], acc) when is_integer(head) do