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.
Nice Solution !!
I liike it.
Ok, thanks for the feedback !
Kata is already retired ^^
Yes, I will read the authoring text intensively.
Cheers
Hi,
chai
must be used to write the tests, instead of the outdated homemade frameworkIf you are interested in authoring kata, you should read the docs before your next try (this one probably won't survive the beta phase).
Cheers
That was just my first idea and try, so I don't take it too hard ;)
Furthermore I could learn something about how the beta phase works and trained writing some markdown.
Thank you for your effort to guide me a little bit, that was impressive !!
peace out ;)
I see you have a test for it, but I also see it doesn't appear to be working. ( I can't submit a solution anymore, so I can't showcase a wrong solution passing the tests ).
Again, the point is moot, so it's not much use to try to fix whatever is broken. But it seems broken. The new testing got insufficient testing before publication. You could have tested this by assigning functions to the prototype - that should have failed, and it doesn't.
( Yes, this is moot, because the kata has been retired )
Unfortunately, that makes
String.prototype.map
identical toArray.prototype.map
, so it makes the kata less interesting ( one can simplyreturn Array.prototype.map.call(this,callback)
). The same goes forreduce(Left|Right)
I think. So onlyfilter
requires actual logic, and it's limited to ajoin("")
. This may ( partially ) be why people are so unsatisfied with the kata ( though lacking implementation certainly didn't help ).Additionally, I forgot that the
Array.prototype
methods have an optional argument for an alternativethis
context to the callback - that should have been tested as well.I don't think it's worth it to try to resurrect the kata. I appreciate your point of enabling for
String
what can be done withArray
, but JS itself already has usable facilities for doing it ( I have been doing it for years without the additional plumbing you made into this kata ).Side note: I have always been amazed by the speed of
Array.from(string)
- internals may have been optimised for exactly this use case.I'm not sure about this one. It's a lot of repeating yourself and I didn't enjoy it that much. But that's just my opinion.
I specified that the callback function of map should be polymorphic and return an array
I specified that the prototype extensions are not enumerable and added a test for that property
Note:
filter
can return a string.reduce
does not have a problem, because it just collapses the string ( just an iterable really ) to a single value and is thus inherently polymorphic in its callback function and initial value. butmap
should really return an array ( or other iterable of arbitrary elements ), because the callback function might not return characters. or you should specify that its callback function must be monomorphicallyChar -> Char
instead of polymorphicallyChar -> a
, which it can be for arrays ( actually(Char,Int,String) -> Char
of course ).Totally right !!
I will get to that right away.
Thank you !
If you want solvers to extend prototypes, require it to be done correctly. Prototype extensions should not be enumerable, this should be specified, and tested.
ETA: Note that I have ranked this kata as a
5
, because if implemented correctly, it's not a7
. Extending prototypes is not for novices.This is not tested completely; it is also specified incompletely.
Array
implementations return arrays. When called onString
operands, they work (!), and return arrays ( formap
andfilter
). If you want strings as a return value, this should be specified.The
Array
implementation callback functions accept not just an element, but also an index and the whole array. This is not tested ( and not explicitly specified, which would be a good thing ).awesome shit !! :D