Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Being able to return a function from inside of another function is a basic feature of functional programming paradigm, and it's not meant to be useful in any particular scenario. It's more of a builing block which can be used as a part of solutions to other problems. It's like with objects in object oriented programming: objects are not meant to fulfill some scenario, but you can build solutions to many scenarios with objects, as well as you can solve them without objects.
This specific kata might serve as an example of working with so called "generators", or "suppliers", or however it's called in terms of functional programming. But it's totally up to you how, why and if you use such supplier, or not.
You probably misunderstood the task, so please read description again. You should not return the result of operation. When tests call
f = function_factory(2,3,'+')
, expected result is notf
equal to 5. Your solution should return a function, which, when called, will return 5:I have not seen your code but I guess your solution makes
f
equal to 5, and test fail when they want to callf( )
because5
is not callable.