Ad
  • Default User Avatar

    Point one should be good now, the other kata did not show up in my search, that's my bad. (also, really, 6kyu, that seems a bit low, even for a pretty much copy algo from wikipedia kinda problem)

  • Default User Avatar
  • Default User Avatar

    since Term and Operator are from the input, subclassing them isn't going to do much sine the test code won't use the subclass. Putting them in preload anyway may be fine, the user can always just remap the input into data structures they find more ergonomic, but I don't really see the advantage.

  • Default User Avatar

    Two equal operators may or may not compare identical via is. This is totally unclear. I guess you mean that the tests will never try to compare operators?

    The point here is that in all the examples, I use something like [Term(1), plus, Term(2), plus, Term(3)], which means the user could figure out that the two operators are the same operator using the python is operator. However, I want to allow the tests to create operators on the fly, so having someones implementation rely on it
    would not work.

    ...and will be parsable unambiguously. There is absolutely no parsing involved, since the inputs are not strings. => that point should be either removed or reworded.

    The way I am familiar with the terms is that lexxing/scanning/tokenising would be the step of converting some input string into the kind of list I provide, and parsing would then be converting said list into some sort of (potentially lazily created) tree-like structure for evaluation.

    Will reword the edge cases sections and remove the suggestion.

  • Default User Avatar

    Regarding extending the kata, I was debating unary operators, but I found it made the problem statement more complicated than I could sensibly explain, and the solution didn't change all that much, Other more complex constructs would be interesting in order to force more powerful parsing algos than <redacted>, but I would rather make a part 2 with those, I think having a kata just about working with precedence in a general way rather than having a set of operators and defining the precedence for those only is interesting enough. (admittedly, I did forget <redacted> existed when writing it, which maybe makes this kata is a bit too easy).

    Regarding binary operators, I mention it in the last sentence of the first paragraph. The still should maybe be dropped though, will change.

    All operators are still binary, but you can't just hardcode the precedence anymore.