Ad
  • Custom User Avatar

    I didn't remove it, it wasn't part of the template when I did this kata.

  • Custom User Avatar

    If floating point values are supposed to be converted, they should probably be part of the tests. Maybe it's language based, but very odd that it's forcing to int.

  • Custom User Avatar

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

  • Custom User Avatar

    I don't recall anything having a reference to &str in the details of this, but if we want to discuss the details of the task:

    Your task is to write a function that takes a string and return a new string with all vowels removed.

    It states that you are taking a string, and returning a new string. So modifying the existing string and returning it is not the same as returning a new string, as described in the assignment. If there is a by reference involved in the solution's template, that may be an update to the kata from the time this, and many other solutions were written. But in any event, the details of the task tell you to return a new string, not the one that was sent to the function.

    /shrug

  • Custom User Avatar

    I don't see how the string is being passed by reference, as you need to specify by reference in the function parameters, and would change how we access the data within the string. But regex_replace creates an empty result string, and then populates and returns it based on the regex rules against the original string. It is not modifying the original string.

  • Custom User Avatar

    This is the several things I was trying to think of that were just escaping me with regard to shorthands I knew I could use.

  • Custom User Avatar

    This is the solution I had in my brain, but didn't get onto the page. I knew it was in there somewhere.

    I'm surprised how many solutions use .replace when it's not supposed to be allowed, though.

  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

    Very often, clever and simple to read/understand code may not be the most optimized. Though, it is strange how long it took to run the benchmark which is similarly blackboxed to the final tests here, but the final test/submission took ~1-2s here.

    My attempt here is to have creative solutions to problems, not necessarily focus on micro-optimization. It is interesting how slow it seems to be when benchmarked, though, moreso when compared against the tests run here.

  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

    Given the initial test asserts the inverse result, I'm not convinced that the other tests are accurate, either. (Shell script)

  • Custom User Avatar

    Are the sample tests meant to not have a single one testing the decorate function we are to define?

  • Custom User Avatar

    The flaw is in the kata writer's logic. They are looking at it as being adjacent after adjacent pairs of directions are removed. In NWSE, they never become adjacent, so cannot be removed. However, it does contradict the intent and meaning behind simplifying the directions provided to the wanderer. It doesn't matter to the supplied solution that it's a circle returning to square one.

    NEWSWW => NSWW => WW. There is a way it makes sense, as only when two opposite directions become adjacent can you be sure they can be reduced. There are no distances included in this, so theoretically, NWSE may return you to a geographically different location than where you started, as units of movement may not be equal. Pure conjecture on my part, but makes it fit. Whereas when you go NEWS, you are literally going backwards and folding your movements back on themselves.

  • Loading more items...