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.
Open your browser console and type 0? true: false and then 0.1? true: false and keep changing the numbers. You will understand, it worked for me.
I've checked this very example in Python and the logic is the same, no error raised.
Oh okay, thanks so much for explaining it to me!
Function can call another function. Let's say the function has been already executed (Stringify) and the flow reached the line "Stringify(list.Next)". At this moment function has been already initiated as the flow "already works" so no error would be rised - but because we are calling same function it is called recursion ... and recursion works for python as well.
I guess my confusion is just how Stringify() is called within the definition for Stringify()?
If I'm remembering correctly, in Python, this would raise an error stating that the method/function can't be called before its been initiated or something along those lines.
First of all study Node class really carefully. You will recognize that Node.data actually holds an integer and Node.next holds...another object Node which holds ... yes an integer and another object of type Node...and so one till Node.next holds null. I suggest to take a look closer at recursion as "conceptually" will not be enough to understand this very example. Answering your questions: When you call Stringify(list.Next) you are calling the method with object Node. Integer of that object is concatenatted to the resulted string (recursively) As i said earlier on Node.next holds another object Node or null. I would call it a tail recursion.
I'm new to C#, and I'm curious what's going on when you call Stringify(list.Next) from within Stringify(Node list); ?
Is this what Manimu means by tail recursion?
I'm also new to data structure so I only really know recursion conceptually.
Are you mutating the input?
Same. I forfeited the kata and saw the top solution was the one I was attempting.
This test is returning double spaces, and that is not what my code is. Anyone else run into this?
This comment is hidden because it contains spoiler information about the solution
Ternary operator.
What is this syntax known as? Specifically asking about
... ? 'odd' : 'even' ;
Test.expect
should be avoided in all languages (even if it is an easy task as this one, it's 8kyu so useful feedback should be provided) and more tests, even random ones would be nice too.Javascript tests are pretty bad, using
test.expect
but you must be doing something wrong to fail them. Try printing the input withconsole.log
and see why it fails. The expected answers are ok.Loading more items...