News for hackers. Stuff that matters.
Re:Recursive Anonymous Functions in Elixir: Combinators and ... by innocentoldguy on Saturday December 31, 2016 @06:38PM (#13293789)
I don't know of any new constructs to support recursive anonymous functions in Elixir, but I don't know everything about Elixir either, so that isn't saying much. You could always create an anonymous function to accept a function, and then pass it into itself as an argument though.

Having said that, I've never ran into a case where I wanted to use an anonymous function recursively in Elixir. Come to think of it, I don't really use anonymous functions much at all, outside of Enum calls, which handle the recursion part for you anyway. What would be the use case?

On a side note, I think this article provided an outstanding tutorial for writing macros in Elixir. Since macros are how Elixir implements metaprogramming, knowing how to write them is a good thing. I typically use macros to write more expressive guard clauses, but you can do whatever you want with them. Chris McCord wrote an excellent book on macros, called Metaprogramming Elixir, if you want to know more about them.

Re:Recursive Anonymous Functions in Elixir: Combinators and ... by macintux on Saturday December 31, 2016 @07:09PM (#13293936)
I know I've come across a case once where I wanted a recursive anonymous function in Erlang, but I don't remember the context. Couldn't do it in R16.

One use case that comes to mind would be nested data structures where you'd like to iterate over each child's children.

Re:Recursive Anonymous Functions in Elixir: Combinators and ... by bubblesocks on Sunday January 01, 2017 @07:17PM (#13298202)
I personally prefer to pull that type of functionality out into a private function. I think it makes the code easier to read.
Re:Recursive Anonymous Functions in Elixir: Combinators and ... by macintux on Sunday January 01, 2017 @09:18PM (#13298634)
I didn't say it was a terribly good idea. I agree, usually.