Functional Programming is not weird: you just need some new patterns
Cameron Price
30621

Hi, Cameron! Nice article! I couldn't help but try to write my version of rem_dupes before reading yours, and I came out with a tail recursive version:

def rem_dupes(list), do: _rem_dupes(list, [])
defp _rem_dupes([], list), do: Enum.reverse list
defp _rem_dupes([e], list), do: Enum.reverse [e|list]
defp _rem_dupes([h|[h2|t]], list) when h == h2 do _rem_dupes([h|t], list)
end
defp _rem_dupes([h|[h2|t]], list) when h != h2 do      _rem_dupes([h2|t], [h|list])
end

It seems clearer to me.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.