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 missed to speak about
Person::greet
. No more sentences, just code:Full code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=6f5a936cd0482aceb70bb839fceb433c
EDIT: I would have optimized by implementing
std::fmt::Display
.I just applied most of my suggestions to made them more clear. I also missed detail about using standard traits. It offers you a lot of advantage thank to generic implementation, you benefit from other traits that have generic implemention over implemented traits.
For example by implementing
std::default:Default
, you are able to create defaultstd::option::Option
.Such
std::convert::TryFrom
would be better thanstd::str::FromStr
!If this is just a "macro-to-function" transformation, you will surely be able to do.
Sorry, long time I haven't post on Codewars. I was just hoping auto-detection due to context and content (just as most services do)
&str
are slices (looks like a "partial" burrow over piece of data). They avoid memory duplication & ownership. It also lets you abstract over&'static str
andString
burrows.As it was specified: two-way alternatives. To be honest, you should be able to directly pattern match over the array
names
.Here we go:
```rust <code> ```
&str
and when you usedif
.createPerson
avoid creating a "default" instance that NEVER be used.&str
) constructorif
are expressions, use it :)if
may alternate on constructor parameters that each calling constructorThis kata like many others by @jhoffner has no sample tests but instead encourages you to write your own tests.
As always, your solution will be tested once you click 'Attempt'.
It shows right for me maybe hard to spot else i missed something?
I am seeing this one:
The call to the solution function is now wrapped inside an
equals()
Hm. Did you forget to save your changes? The translation is still the same.
Oh looks true that, thanks. Fixed that up.
The random test is bogus:
That's just a replication of the previous test, since
x*x
should returntrue
. You want to useassertEquals
or whatever its called in Dart:Shows as error but actually it should just be a failed test?
To address the edit problem mentioned by @bkaes, I would suggest to allow forks of those katas, if a critical amount of complaints about the description sum up. Then by time people should be able to give their vote on the kata (fork or original) they like best. If one is clearly preffered by most people (like 70% to 30%), it should be displayed as standard description for the kata.
(I miss something like that on Wikipedia!)
Done. Thanks for the feedback!
This comment is hidden because it contains spoiler information about the solution
Requests:
Suggestions:
(Javascript) Solution passed, but tests failed for unknown error... That was a bit annoying