Ad
  • Custom User Avatar

    In C++ for some reason random tests fail but when I put the string used in the failing random test as a sample test it works, does anyone know what causes that?

  • Custom User Avatar

    The precedence of = is lower than that of +. You should be parsing hijwpyk = 73 + 44 as hijwpyk = (73 + 44) not as (hijwpyk = 73) + 44.

    It looks like the error message has the "expected" and "received" backwards -- that is, your code said 73, but the expected value is 117.

  • Custom User Avatar

    Your C# "tokenize" method is a mess. For some unknown reason it adds closing parenthese ")" to the end of the input. Also, the regex is a complete mess too, it does not parse numbers at all and there are other issues with it.

    Why even have such starting code if it is wrong?

  • Custom User Avatar

    OP solved it, closing.

  • Custom User Avatar

    To those that get inexplicable precision problems: your code most likely has a conversion of double to float at some point(like the modulo operator) and loses precision.

  • Custom User Avatar

    You must throw an exception in cases like referencing an undeclared variable or an input that doesn't evaluate to an expression

    Look at how the last basic test works, it expects a throw when trying to get a non-existent "y"

  • Custom User Avatar

    C++
    What is the meaning of this test failure:
    Expected: equal to "Error caught"
    Actual: "Error not caught"

  • Custom User Avatar

    How perform operations between numbers and functions

    x * function x y

    function x y * y

    and function and function

    functionA x y * functionB y x

  • Custom User Avatar

    Looking at this kata but haven't tried it yet. That said, the parser would know how many parameters the function needs when it sees its name. Thereby knowing how many expressions to parse to be able give it the parameters it needs. Keeping in mind that an expression would continue to parse as long as it possibly can and still being a valid expression. Thus the parser would parse two subsequent expressions (resolving "2 + 5" and "3" respectively) and give them to the function, evaluate it, and continue on.

    It will not stop at just the "2", because "2 + 5" is a valid expression; it will however stop there, because "2 + 5 3" is not a valid expression (as per the grammar).

    I hope that makes sense.

  • Custom User Avatar

    Definetly a Tough Kata, but worth it. I learned a lot from this one :D

  • Custom User Avatar

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

  • Custom User Avatar

    I don't know if you've solved it yet, but you just have to throw an exception, any.

    The Interpreter can continue after that.

  • Custom User Avatar

    Looks like not all inputs are displayed in log for C#.

    For example in "conflicts" tests i can see only:

    input("fn x => 0") == <> was ok
    Test Failed
    input("f = 5") == <> and not <5> => wrong solution, aborted!
    

    But with Console.WriteLine(input) i can see:

    x = 0
    fn f => 1
    fn x => 0
    input("fn x => 0") == <> was ok
    f = 5
    Test Failed
    input("f = 5") == <> and not <5> => wrong solution, aborted!
    

    Also in "variables" tests in log i can see input("y") == <> and not <25> => wrong solution, aborted!

    But in previous "function" tests with Console.WriteLine(input) (not in default log) i can see

    x = 23
    y = 25
    z = 0
    ...
    

    So I thought there should be different scopes for different sections of the tests. If not, then the answer in "variables" tests should be y = 25

  • Custom User Avatar

    Can anyone tell me how the remainder of the division is implemented in the tests?

  • Custom User Avatar

    Thanks for the answer, but I use 'double' everywhere. I suppose the problem is the verification

  • Loading more items...