• ###### pearcebasmanmcommented on "Find maximum number that can be formed using digits of a given number" kumite

I've been wondering, do you think random tests are helpful in kumites? It looks like asserting the equality of two implementations, which only works when the reference is known to be definitely correct (in which case, why not use it in the first place instead of doing testing?).

Or maybe you're writing them just for practice, I don't know.

• ###### pearcebasmanmcommented on "Number of Decimal Digits" rust solution

It's a good implementation, but by nature converting a number into a string is much more complicated than a simple while loop which runs a dozen or so times.

• ###### pearcebasmanmcommented on "Tortoise racing" kata

Because sentinal values are a bad idea for many reasons, though you probably already learned this in the 4 years since.

However I'm still bamboozeled as to why it returns `Option<Vec<i32>>` as opposed to `Option<[i32; 3]>`. This isn't an arbitrary list, it's exactly 3 elements. I might even expect `Option<(i32, i32, i32)`.

• ###### pearcebasmanmcommented on "Deleting vowels in a text" kumite

Mind clarifying? Rust implicitly returns the last expression in a function body if that's what you were wondering.

• ###### pearcebasmanmcommented on "Test Nagatech Intermediate #1" kumite

lol. I've checked on godbolt and we've been getting less and less efficient (at least in terms of assembly length). My initial solution was 186 lines, then 247, and yours is 504. It's not an actual speed comparison, but assuming it's a similar effect, that would show an inverse relation to legibility.

Yours is definitely the most legible, whereas my initial minimizes the number of passes.

• ###### pearcebasmanmcommented on "How many consecutive numbers are needed?" kata

Is there a reason `usize` is not used for the return type? It seems more natural if we're going to do conversions anyways, since a negative value is meaningless. Plus now there are situations where we can't give the correct answer. `[i16::MIN, i16::MAX]` would product an answer of `2^16 - 2`, which is way to big to fit in an `i16`. I guess if we're going for minmalism `u16` would be the appropriate type, but would require more conversion unless the input was also `&[u16]`.

• ###### pearcebasmanmcommented on "Non Repeating Character Optimization" kumite

I understand that take, but not from a JavaScript developer. I'm intrigued. What do you think makes it worse than JavaScript?

• ###### pearcebasmanmcommented on ""Is it a letter?" Rust Translation"

Hmm, the descritions looked identical, but in the editor there was some weird old/===/yours formatting that I removed in the new fork. They should be identical behind the scenes too now.

• ###### pearcebasmanmcreated an issue for "Reducing by steps" kata

The Rust translation needs some work.

• Tests should be in a `tests` module with `#[cfg(test)]`
• `&[_]` is more idiomatic and flexible and should always be preferred over `&Vec<_>`
• `-> ()` return type is moot and discouraged.
• The spacing should be inline with rustfmt, which leaves an empty line between functions, and spaces lists as `[a, b, c]` instead of `[ a,b,c ]`.
• The `todo!()` macro is a more idiomatic way to mark unwritten code, rather than a comment that fails compilation.
• The type for a function that takes 2 `i64`s and returns 1 is `fn(i64, i64) -> i64`. The user shouldn't have to write their own function signatures.
• The reference solution is needlessly complex.

Updated

• ###### pearcebasmanmcommented on ""Is it a letter?" Rust Translation"

Rust tests are run in parallel with nondeterministic ordering, though with only two of them it would be easier enough to submit until such a solution passed. Added random tests.

• ###### pearcebasmanmcommented on ""Is it a letter?" Rust Translation"

I've improved the non-sample assertion messages.

Random tests don't do anything if the test coverage is exhaustive. Though I might have missed some characters, so please let me know. I'm assuming only ascii printable characters are included.

• ###### pearcebasmanmcommented on "Find maximum number that can be formed using digits of a given number" kumite

Good work!

A few notes if you're interested (ignore if not):

• unit `()` return type is typically omitted
• random tests don't do much when you're testing the same function on the left and right side
• the later arguments in `assert_eq!` are already equivalent to `format!`

Forked with these changes and a few more. Feel free to ask me if you have any questions.

• ###### pearcebasmanmcommented on ""Greed is Good" Rust Translation"

I had no idea. Thanks for letting me know.

• ###### pearcebasmanmcommented on ""Greed is Good" Rust Translation"

More precisely used array of length 5 instead of slice, improved the error meesage, and general formatting improvements.