7 kyu
Fac Recursion (Pest control - find the bugs and fix them)
821 of 1,071pmarek
Loading description...
Recursion
Debugging
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Your function did not recurse enough times - Expected: 4, instead got: 3
Why it's occurs ? My solution is completely written in a recursive way
This is an Idiot test, the author checks that you really use recursion or not. This quest is over 7 years old, so forgive him for that
Recursion checking code does not work with lambdas.
It also relies on
Function.prototype.toString()
.Note: this is a bug fixing kata, whose definition is something like "fix bugs" not modify the current function completely which is what you would be doing if you would make it a lambda. I don't believe this is actually an issue... and If relying on
Function.prototype.toString()
is really an issue then you can restore it from a instance instead of using a potentially modified one?A recursive function is still recursive even if it's a lambda, so it's perfectly according to specs. This has nothing to do with "bugfix" or anything.
And of course, relying on
Function.prototype.toString
is not the best practice because, you know, you can just obtain the user solution code.my code passes 7 tests and fails 1. not sure what the last case is testing, so I don't know how to correct my code.
It's your first kata. :-) Great.
But some hints for you:
You should write in the task, that this is a bug-fixing-kata. Maybe also in the title. Add random tests.
Thanks for the feedback. When you say "random tests", what exactly do you mean? Tests with random input or what kind of tests?
tests with random input.
Well, I think I added random tests, at least I hope these are the kind of tests you expected :D
good. :-)
There are no inforcement tests to make sure the kata is recursive.
How can I make sure, that the solution is recursive, if the recursive method itself is private, without playing with the visibilities? Or am I just thinking the wrong way?
I'll do some testing and get back with a solution :)
This comment has been hidden.
Well, I applied your solution, but I'm not entirely sure what it did :D
This comment has been hidden.
Note that your code breaks for lambdas.
No random test and duplicate of https://www.codewars.com/kata/factorial-recursive.
this is a bugfixing kata though unlike the one you linked.
Maybe but you don't almost have anything to change... Recursive factorials are everywhere:-)
if it enforced the requirement of recursion and some percentage of change being a bug fixing kata then it would probably be unique enough to not be considered a duplicate?
Hey matt, there are two translations for your very good kata "Large Factorials".
Well, random tests are in it, so I guess this is resolved? I must say, this is pretty funny :)