Ad
  • Custom User Avatar

    In this kata there is no function name for bash, you must just write the instruction to echo the expected result, assuming that the input is $1 (I agree this is a bad design, but one can find the same on some other katas...). I always had the impression shell set up was a bit awkward on Codewars. At least a single comment could be included in initial code giving basic indications. I agree this should be considered an issue, but actually I believe many shell katas would desserve to be revisited in the same sense.

  • Custom User Avatar

    The kata's description is shared amongst all languages and in most of them you need to write a function. If you think that bash instructions should be different, then create an issue.

  • Default User Avatar

    In shell, this kata only has a single test case, it needs more.

  • Custom User Avatar

    OK. Solved it in quick and dirty way. As tests are ... there are no tests for Bash. The problem was with kata's wording.

    The author writes: "Your task is to write a function that takes a string ..."

    A function!!! WTF! What he/she really wants is just a command with args, not a function!

    To solve this kata in a proper manner just write a command, not a function. That's it folks!

  • Custom User Avatar

    In Bash it should be

    func_name(){echo "${*}" | and here command that devowels input string}.

    I know it, and it works in scripts. Been writing for years.

    But how on Earth is it to work here? Please, help with a hint.

    I do know the command itself. It's not sed params, them I know.

    I am interested in syntax. Tried it with an old format (function func_name {etc.}). Didn't work either.

  • Custom User Avatar

    Example for plural endings in Russian (hour - hours, minute - minutes):

    1 час -
    2 часа -
    5 часов -

    1 минута -
    2 минуты -
    5 минут

  • Custom User Avatar

    Well, the docs are very clear when it comes to explaining the raise keyword. This is the standard, most acceptable way of reporting that something went wrong in the code. What would you suggest instead?

    I'm not trying to sound condescending (and I hope I'm not being toxic here!), but I don't understand how you could possibly use try here.

  • Custom User Avatar

    Thanks. I do know about documentation. Please, take trouble and read it (your link). From the first page you've got try:/except: examples of raising ValueError. What I suggested, might improve this kata and Codewars in general. If there would be less trouble with single instances (katas), the better resourse it would be. Yours (1 kyu rating) is not for being toxic, right? :-)

  • Custom User Avatar

    Not a lot better but, what about this?

      it("Test zero", function() {
        assert.ifError(circleArea(0));
        assert.throws(() => circleArea(0), Error);
      });
    

    That shows this error:

    Error: the string "Error" was thrown, throw an Error :)
    
  • Custom User Avatar

    I noticed this but I have no good idea how to prevent this. The crappy message comes from Chai :( I will try to figure something out, maybe craft my own assertion.

  • Custom User Avatar

    Searching for 'raising ValueError' and code skills previously learned lead people to try:/except: solutions.

    There's the official documentation you know...

  • Custom User Avatar

    OK. Not everyone (1 dan) yet here. Searching for 'raising ValueError' and code skills previously learned lead people to try:/except: solutions. None of which, obviously, works.
    And these katas are for codders who are not expert-super-duper pros. They are for novices. That is why a helpful hint in description of the kata, or a hint in test evaluation would be much appreciated by them. To that, I admit, that I confused "raising an error" with "handling an error". Now will remember the difference. Thanks.

  • Default User Avatar

    rejected by someone, and the author closed their account

  • Custom User Avatar

    but... what are the "another methods of raising ValueError"? You confused "raising an error" with "handling an error" - try:/except: is used to handle errors raised by someone, somewhere, and not to raise errors. The description asks users to raise an error and not to handle an error, and this should be enough of an explanation that try/except in your solution is not needed. How would I have to change the tests or description to help with such confusion?

  • Custom User Avatar

    Was really confused by "raise ValueError" part. Tried to do it as usual in try: except: blocks. The code worked fine locally, but not here in Codewars. This kata tests should either include tests for another methods of raising ValueError or change description. For codders to come: do not use try/except here. You'll find the right way quicker to get through this kata.