Ad
  • Custom User Avatar

    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.

  • Custom User Avatar

    I've checked this very example in Python and the logic is the same, no error raised.

  • Custom User Avatar

    Oh okay, thanks so much for explaining it to me!

  • Custom User Avatar

    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.

  • Custom User Avatar

    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.

  • Custom User Avatar

    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.

  • Custom User Avatar

    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.

  • Custom User Avatar

    Are you mutating the input?

  • Custom User Avatar

    Same. I forfeited the kata and saw the top solution was the one I was attempting.

  • Custom User Avatar

    This test is returning double spaces, and that is not what my code is. Anyone else run into this?

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Ternary operator.

  • Custom User Avatar

    What is this syntax known as? Specifically asking about

    ... ? 'odd' : 'even' ;

  • Custom User Avatar

    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.

  • Custom User Avatar

    Javascript tests are pretty bad, using test.expect but you must be doing something wrong to fail them. Try printing the input with console.log and see why it fails. The expected answers are ok.

  • Loading more items...