Thanks for the feedback. Often do I wish for a strongly-typed javascript. It is explicit in the description that
This should be a general function that takes as input any positive integer, and returns an integer
and I used the quotes mainly to reduce confusion when talking about numbers of digits ("there are 2 1s" is weird). I can add a test case that checks the type explicitly; in addition, I might replace all " with inline-code backtics ("there are two 1 digits"). Would that solve the problem?
I'm torn about ranking this. On the one hand, the actual statements involved don't invoke anything more complicated than a first-class function. On the other hand, the solution requires a good bit of research, or having taken precalculus.
I'm not certain we're talking about the same thing; I was suggesting an additional test case where you pad e.g. -27 to -00027.
In any case, it will mean many submitted attempts will not work; however, the submitters will not lose honor or rank progress, and they will be able to update their solution to make it validate all the tests again. This same thing happened with the What Century Is It? kata. Beta is a good time to make these changes.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This is because strings are an iterable, with each character as a seperate element. It's the same reason you can do "for char in s".
Indeed; I tried to remove that two days ago when making wthit56's edits, but it appears the republish didn't complete. Now it is removed.
Thanks for the feedback. Often do I wish for a strongly-typed javascript. It is explicit in the description that
and I used the quotes mainly to reduce confusion when talking about numbers of digits ("there are 2 1s" is weird). I can add a test case that checks the type explicitly; in addition, I might replace all " with inline-code backtics ("there are two
1
digits"). Would that solve the problem?This was fun. I formatted mine to show that it can generalize to arbitrary dimensions, if anyone's interested.
This comment is hidden because it contains spoiler information about the solution
One of my favorite katas! It's a lot of fun to use entirely recursive solutions.
What I wouldn't do for one-based arrays
Great kata. You could make the tokenization a little harder by including a molecule with a multi-digit number in it, like
C6H12O6
.I'm torn about ranking this. On the one hand, the actual statements involved don't invoke anything more complicated than a first-class function. On the other hand, the solution requires a good bit of research, or having taken precalculus.
I feel like I cheated with eval(); maybe you want to disable that?
One of the examples is wrong.
It says
0.001 == 1e-2
, but my JS console (and my high school math) say1e-2 == 0.01
Since we're working in both minutes and hours, can you clarify the units on each function input?
I'm not certain we're talking about the same thing; I was suggesting an additional test case where you pad e.g. -27 to -00027.
In any case, it will mean many submitted attempts will not work; however, the submitters will not lose honor or rank progress, and they will be able to update their solution to make it validate all the tests again. This same thing happened with the What Century Is It? kata. Beta is a good time to make these changes.
Loading more items...