6 kyu
Get all array elements except those with specified indexes
446 of 507int3_0xcc
Loading description...
Data Structures
Arrays
Logic
Fundamentals
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.
( Haskell, possibly others )
The description does not specify passed indices will be inside the passed array. It also does not specify the indices will be sorted.
The Example tests only have tests that imply these conditions, however, hold. Specifications should be complete. If you cannot make certain reasonable assumptions, preferably explicitly specify that, and / or at least disabuse solvers of silly notions in the example tests. Having such requirements unexpectedly pop up in the Submit tests is dishonest.
Haskell : https://www.codewars.com/kumite/5b90541d41d11a6cad000077?sel=5b90541d41d11a6cad000077
Accepted :)
Haskell : https://www.codewars.com/kumite/5b90541d41d11a6cad000077?sel=5b90541d41d11a6cad000077
Ruby translation submitted
Nice :)
:)
Awesome kata!
CoffeeScript translation kumited! Please Accept :D
Thank you :smile:
This comment has been hidden.
See my reply to @jeffersonsnow
This comment has been hidden.
This comment has been hidden.
You are modifying the source array. You should leave it intact, instead the method should return a new array instance without specified keys. Because you modify the source array, the array passed to further tests has less elements than it should have had.
That makes sense now. Thanks for the tip. I just solved it.
Mine works fine for the letters but where do all the numbers come from in the random tests? Am I supposed to accept outside variables as the array to edit or? How am I supposed to do this
...and this time, sorted output is not expected? Again, being clear about this in the instructions would be helpful.
Inconsistent argument data types. Bah!
Single element arrays are perfectly good. You don't start counting from 1 either, do you?
It's common in real life software, for example:
https://github.com/laravel/framework/blob/5.2/src/Illuminate/Support/Collection.php#L238
( line 238 has a function with almost identical signature )
JavaScript is a dynamically typed language, you know. Sometimes it's just way more convenient to write a single number without brackets. Those lazy people!
Oh, JavaScript itself does it. Look at the arguments to
new Array(..)
- an integer can have different meanings depending on how many of'em there are. :[ Or, my pet peave, the possible return values ofString.prototype.replace()
. That doesn't make it good design though.But if you consider that a good enough reason to incorporate it into your kata, well, it's your kata. I do hope we can agree that it is ++Ungood Design, and that it should be taught to people as such. So a (bold, blinking (talk about bad design :) ) warning in the Description might not be out of place. Novice programmers read and solve these kata, and learn things.
Those lazy people - they have to type two characters less in one place, and sixty (I counted (conservatively)) more in another place.
@JohanWiltink,
While I do agree that it is generally considered best practice to adhere to a particular data type for any given argument in any function/method regardless of the nature of the language itself, I think that this should be labelled as a "Suggestion" instead as this "Issue" does not affect the completability (if that's a word) of this Kata - it's not as if the Description makes no mention of the argument being a number and not an array in some cases.
Cheers, donaldsebleung
Probably just in "Draft" because of wrong random tests;-)? Happy new year:-)!
Yep, you got me :). Should be fixed now.
Happy new year!
Yes, works now.-)! Code submitted;-)!
N.M. my bad :)