Earn extra honor and gain new allies!
Honor is earned for each new codewarrior who joins.
Learn more
  • The requirements have been updated to "if every element in an array is an integer or a float with no decimals".
    Missing Clojure example in the description.

  • came back and sorted this out, finally.

    Text contains newlines which of course isspace() matches, so checking against both 0x20 and 0x0A works as "expected". Apparently the problem was I didn't always seek forward to the next line before reading out the next label. Taking word after word would get me there "accidentally" but then every word was being handled as 'the next label'. The only thing between a line's last word and the next line's label was '\n' so the next real label I took would start with "word\n" and so would never match anything while seeking ahead, so trying to goto anything would walk right off the end. I think.

  • Your code will fail everywhere when called more than once, don't use global vars. Also, the name of the function is wrong.
    Don't forget to mark your posts as having spoiler content next time, and also, use markdown formatting when posting code so it doesn't lose indentation.

  • Python works fine. If you have a problem with you code, post a question, not an issue.

    Also, you do know that Python is an interpreted language right? It isn't compiled.

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

  • The description doesn't mention that the same buffer will be used between tests and it needs to be cleared manually.

  • There should be some test cases where the same label digits are also in the "text" parts of the lines.

    This will check if the goto is really going to a proper label or not.

    I'm sure some solutions are not handling this.


    10 Ali Baba and the\n
    20 goto 40\n
    30 40 Thieves\n
    40 forty Thieves\n
  • Kotlin Translation kumited. Please review and approve if all is well with thee.

  • There's no yield, there're no blocks, so it doesn't really match the original kata.

  • Odd, isspace() works fine on the, uh, spaces-- while comparing each char to ' ' or 0x20 simply does not match. I'm probably forgetting something really dumb but I used that loop-test-pattern plenty of times, and now it is just looping right over the end of the destination buffer, and crashing.

    The same code still works here to detect '\n', and if I hexdump the source string from within the program, it has ordinary 0x20s everywhere.

    Now I copied and pasted one of those other lines, changed '\n' to ' ', and it stops crashing (edit: this is probably due to expanding sz) but it suddenly doesn't match the destination label correctly (edit: of course the label wasn't taken right the first time, nothing will ever match except by insanely dumb luck, so the very 1st goto prevents everyhing else). Maybe my browser is flipping out and mishandling text, I don't know, it doesn't even matter, it's just... bizarre.

    while (!isspace(*src++)) works normally
    while (0x20 != *src++) will never detect a space (i.e. never stop), but works fine for 0x0A ????

    ...fortunately it's reproducible locally with gcc. Which means I'm missing smth. This loop is for reading out each label. There is a 0x20 at the end of a label. The second character of the first sample test's first line is 0x20. I am having a bad day.

  • Seems a bit incomplete with regards to testing.

  • Sorry, I was too lazy to DRY it up, lol...

  • Great kata. So beautifully simplistic. Thank you!

  • Loading more items...