Ad
  • Default User Avatar

    I submitted this solution by mistake (and it seems CodeWars doesn't allow deleting), it doesn't cover matrices that aren't squares, and it has a leftover console.log in the beginning... See my other solution for a correct version.

  • Default User Avatar

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

  • Custom User Avatar
  • Default User Avatar

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

  • Custom User Avatar

    There is no such number like "MMMMMMM". The number system limits at five M's I think.
    And I approve that this is really interesting, check mine too, it is funny as well. :)

  • Default User Avatar

    The test's description has a few English grammar mistakes.

  • Custom User Avatar

    Added

  • Default User Avatar

    add tests

  • Default User Avatar

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

  • Default User Avatar

    Thanks for responding anyways, first person to actually comment on anything I wrote / did on this site...

    Cheers.

    p.s.
    sorry, haven't seen The IT Crowd, heard it's good.

  • Default User Avatar
    1. I agree that we disagree! ;) Right about the situation, of course. But the present context doesn't seem constraining enough to require mutation. Again, seeing instance method doesn't imply mutation. Just instance method. Well, just my opinion.
    2. yes, might be a bit confusing, but it's in the description (somehow... :/ ). So you won't be my hero of the day, so sad... ;) (it comes from a somewhat-now-old TV serie)

    cheers

  • Default User Avatar
    1. Let's agree to disagree, I think the "best practice" for this depends on the situation, and this situation implies mutation, unless otherwise stated.
    2. Obviously after solving it I understand what was meant, I'm just saying it might be confusing to some people and could use a bit of clarification. (sorry, didn't get the joke)
  • Default User Avatar
    1. yes it is. Mutation allow quirky bugs to slip through implementations where you do not expect them, especially in big projects. If you can avoid mutation, avoid it. If you're in absolute need of memory or performance, though...
    2. nope: you check if the length are different, if they are, the vectors are just not equals. You're at Disney Land, you hold the entry of an attraction. Boys go on, you check their height with a barre at fixed heigth. What do you do if their "length" isn't good? You just say "Sorry boy, you cannot do that attraction", or you throw an error "damn,-that's-not-good-that's-not-good-FIRE!-FIRE!-FIRE!-Call 0118 999 881 999 119 725...3!!!" (the person you understand that joke is my hero). Well if they are just not equal, you return False, that's all. All the same, check the description, equals is not in the functions concerned with exception.
  • Default User Avatar
    1. That's always the best practice to create a new object instead of modifying the existing one? When I see a method "add(vector)" on an object I think it's reasonable to assume it will modify that object.
    2. The description says "an equals method, to check that two vectors that have the same components are equal", by reading this I thought "that have the same components" means that a different amount of components should be considered an error, like in the rest of the methods.
  • Default User Avatar
    1. that's the best practice behavior, yes (EDIT: description updated)
    2. that's the normal behavior (throw an exception shouldn't even touch your mind in that case! ;) )
  • Loading more items...