Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
I applied minimal changes to remove the warnings that appear in stderr, as well as updating the description for Rust to use the correct terms
field
andstruct
. Code style could also be improved but I didn't want to editorialize.This is the nature of
Freestyle Sparring.
We take turns remixing and refactoring each others code. If you want to make the code shorter, just fork it!🍴bro im trying to make the code short
I appreciate your counterplay - Good job!
using
string
as a parameter name is bad practice because it overwrites thestring
moduleAh, we've gone full circle now.
Interesting, thanks, we'll have to look at that with a benchmark.
This comment is hidden because it contains spoiler information about the solution
It doesn't seem to be bad at all. There are always nitpicks like an unecessary
.to_string()
before parsing and type hint that would have been inferred, but it looks like pretty standard Rust code.Though I do wonder, if you wanted to write a Perl solution, why not fork it in that language directly?
Thanks, I'm really not very good at Rust as you can probably tell.
Just so you know, the purpose of
.expect("text goes here")
is to provide context if the unwrap panics. If you don't feel the need to provide context, a simple.unwrap()
makes more sense.I'm currently learning programming, and writing random tests is part of my practice to understand different testing techniques.
the description says
It's all part of my learning journey. Thank you for your insights!
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.
add random test
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.
Loading more items...