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.
No problem, and you can (almost always) use
console.log
to print the input and check what it was.This comment is hidden because it contains spoiler information about the solution
Javascript.
Ah, is that so. I didn't think that would be the case. I'll look into it. Thanks
Just asking out of curiosity, which language did you solve the kata in?
match
not always returns an array, check that.Yes, I'm using
match
. And btw I checked once again. The sample tests run fine now. But the problem persists when testing for random tests withAttempt
.I've tried my solution again and it passed. You didn't say, but I guess that's in javascript. Are you using
match
?I seem to be having a problem. But I'm not sure whether it's an issue with my own code or whether there's a problem with the kata. All the sample as well as the random tests were successful. However, in both the sample and random tests I get this
TypeError: Can't read property '0' of null
. And the thing is, with everyAttempt
, the number or errors keep changing. From 8 errors, to 5 errors or 6 errors or 2 errors.There doesn't seem to be a problem with the code though. I copied the entire thing, both the function and the input and tested them in the console. Didn't get the TypeError.
This comment is hidden because it contains spoiler information about the solution
Could be because it looks cleaner?
I have a similar solution but use slice to keep the original array as it is. It's certainly not required to pass the test cases but I think is a nice challenge.
I'm the F# and OCaml translator, so any suggestions for those could be tossed my way. :)
That's a good criticism; I was "following along" with the Javascript translation and didn't think to check how the Haskell translation worked.
That being said, I found that having the signature as a list actually made my solution simpler. Although I suppose that's subjective ;)
Try to
print()
the input and figure out what it should return and how it should behave...Hello. I tried solving this kata in Python. It passed 7 basic tests and then gives a stderr saying that an 'int' object is not subsciptable. I copied the whole function and tried in Python IDLE (Python 3.4.4). I gave it all the signature inputs specified in the basic tests. It didn't give me any kind of error. What has been going wrong?