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.
I did the same thing. However I am not sure if its faster than the hardcoded solution
very clever!
Is that solution same as if function that select in each operator or it will process all the operator function?
Every thing that is hard coded or using simple functions should be faster
No, it's not. In fact, over a high number of invocations of the function, it probably actually be slower (allocation + hashing + lookup vs string comparison) The point of this isn't performance, it's convenience.
This looks very nice. But could anyone tell if this is really faster than the mundane if else control flow method?
Thanks.
Smart!
I love you
This is so smart
very interesting!
I did not say that the add function thows a ZeroDivisionError. :-)
Please evaluate the arithmetic function and call it with arithmetic(1, 0, "add"). You will get a ZeroDivisionError.
how can the add function give zero division error???
Would be useful to add this to the test cases then.
not that much. Try this:
arithmetic(3,0,'add')
and look at what happens... ;)NICE ONE!!
Loading more items...