7 kyu
Merging vectors without reallocation
133Heiss
Loading description...
Fundamentals
Refactoring
Debugging
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
I really appreciate the effort of this kind of educative katas, especially for a language like Rust (lifetimes give me frequently headaches), but, with the new version of this kata (I mean the function's signature that has been amended) I have tried something out intuitively and it worked immediately, I don't feel like I learnt anything (yesterday I was unable to solve it, though reading the documentation...). Maybe it would be nice to have something more elaborated but with more step by step / documented instructions? Just an idea...
The error message generated by the compiler gives away the solution entirely. Unless it is possible to suppress it somehow (which I doubt you can), this is a really bad idea to make a kata of.
I wouldn't say "entirely". As a kuy8, the intended audience would still need to figure out what to do.
I literally copy-pasted it and passed the tests, what do you mean "not entirely"?
There's no such thing as "intended audience".
Hey. Thanks for your comment. There are katas already with missing characters like ; or {, which can be autofilled by compiler. So I thought it would be a good idea to create a kata to show a first example about the lifetime concept of rust. And for a kyu 8; is it not okay to learn to work with the compiler messages?
Can you give an example that is relevant to the issue I raised?
Do you even understand why I raised this issue?
I cannot find the first kata, i solved on codewars. But it was such a task to add { to a function signature.
But i found this one: https://www.codewars.com/kata/50654ddff44f800200000004 Is this not relevant to your issue? The compiler says, what you can do to fix.
Can i extend the kata to solve your issue? This is a fundamental concept of rust to show. I want to focus on this concept, but without any need to change the function implementation code. Maybe you have a suggestion.
In that case, Rust is simply not the right language for this type of bugfixing problems - you can't make a meaningful kata if the compiler is giving away the exact code that you have to type in to make it work.
You are right.
I changed the signature, so the compiler does not show the solution, but helps to figure it out. And more; if you use the compiler it suggests the wrong fix at first.
That's an improvement, although I'm not sure whether I really like the fix. IMO, it'd be better if
ys
had a lifetime of&'b
instead of an undeclared&'c
, so that the task is focused solely on resolving the lifetimes problem rather than have an additional step of fixing a typo (only to arrive at the following code anyway):Perhaps you could change the initial solution to make the user debug an incorrect attempt at fixing the lifetimes instead, which I think would be more interesting:
but that's up to you, whichever thing you choose, the original issue is okay resolve as is.
Thank you. Wonderful suggestions. I like the second idea more.
https://www.codewars.com/kata/reviews/617dcc247df1ed0001ffed07/groups/617e58b6301d7a00012cb7d9 Maybe it doesn't matter too much for an easy kata, but testing against this is easy too, so I think this solution shouldn't pass.
Thank you for your input. I am a beginner for rust and codewars, so i want to learn more about both while i create a kata. So i try to figure out, how to handle static lifetimes. But currently i have no clue.
@Unnamed all of the solutions you've submitted do not pass anymore; please, check whether the issue can be resolved now.
Well, some workarounds are still possible, but they require managing lifetimes at least to some extend, so I guess it may be OK...
You should add the "refactoring" tag.
Done. Thanks