News for hackers. Stuff that matters.
Re:Using Recursion in Elixir by segmondy on Sunday September 06, 2015 @10:44AM (#10177780)
I'm sorry but that article is terrible. I don't even program in elixir, but if you are trying to don't even use this. There is no recursion, just pattern matching.
Re:Using Recursion in Elixir by chrismccord on Sunday September 06, 2015 @10:51AM (#10177797)
This kind of commentary is not welcome. The author of this post is learning and sharing his thoughts, i.e.: he closed the post with this comment:

> I know that there is a ton of room for improvement – so if you have a thought please share.

Sheesh.

Re:Using Recursion in Elixir by zzalpha on Sunday September 06, 2015 @11:02AM (#10177824)
Agreed on the tone, that's unnecessary. Even my own post is borderline... I'll edit it to fix that.

But this guy is ostensibly a professional. His CV lists a host of industry experience over the years.

And yet it seems he doesn't understand recursion? That's... Remarkable.

Re:Using Recursion in Elixir by speedkills on Sunday September 06, 2015 @11:52AM (#10177964)
Serious question, is pattern matching in Elixir any different from overloading?
Re:Using Recursion in Elixir by ericmj on Sunday September 06, 2015 @12:25PM (#10178071)
Pattern matching and function overloading based on types are different but can be used for the same purposes.

For function overloading the decision for which implementation to use usually happens at compile time along with the type checking. Pattern matching happens at runtime but is more powerful since you can pattern match based on you guessed it: patterns, instead of just types.

Another small difference is that with overloading multiple functions with different signatures are created (they just share name) but with pattern matching there is a single function with multiple "function clauses".

Re:Using Recursion in Elixir by speedkills on Sunday September 06, 2015 @12:48PM (#10178148)
Great explanation. Thank you.
Re:Using Recursion in Elixir by zzalpha on Sunday September 06, 2015 @04:49PM (#10178950)
To provide a shorter answer: polymorphism dispatches on types at compile time. Pattern matching dispatches on values at runtime.