But WHY?
I started to read a book about the amazing Elixir-programming language but I'm stuck when it comes to function returning functions. Good thing I'm reading this not alone!
Together with a very dear friend of mine I started a small two-person book club as we felt we didn't have enough time and opportunity to educate ourselves. The idea: Pick a book, talk about it and bring in a tiny bit of social pressure, maybe it helps. At the time writing we read "Programming Elixir" (again).
The most important thing: It shouldn't be stressful, and it shouldn't interfere with the rest of our lifes. We meet from time to time, like once every or every other week, and talk about what we read since the previous chat. But it should be fun and it has helped me stick to the book so far.
In the chapter about "Anynomous functions" there's a subchapter "Functions can return functions". I understand, that this is possible and how I can do this, but what I don't get is this: Why? Why should a function return another function? Why is it so much better than having another dedicated function that does the same thing? What's the use case for this?
I don't get it (yet), maybe my thinking isn't used to this functional programming? Passing a function as a parameter into another function, that's something I understand, I do this all the time, it's pretty common in Swift, too. But returning a function? Still feels weird and I can't thing of a reason for that.
Good thing, that I have someone to talk to about these things in the little two-person book club 🤓