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.
So you think this kata is out of place ? I can hear that :)
I thought that it could be fun to try and work with functionnal concepts in javascript even though it is no really a functionnal language. I had fun doing it at least.
I'm not satisfied with those constraint either. It's both too restrictive and not enough (as voile said, the problem can be bypassed using classic boolean operators).
I could disallow those too (
&
,|
and~
) the same way, but this would further restrict indentifiers.How can i disallow everything apart function expressions (for lambdas), function application without restricting identifiers ? I could use the AST, but i don't think that i could import external libs ... or i must read a CDN version using a
http.get
but that might be brittle and a bit much work for testing.Maybe restricting identifiers to chars can be accepted ?
Yes, you can only return 5 numbers from the input array.
fixed it
Well nevermind :)
hu, that's cool ! I haven't thought that returning a pair gives you more information.
A follow-up could be nice.
fixed it
Two tests were wrong, i managed to republish with that fixed
Initially i froze the prototype of
String
to avoid tricks withvalueOf
returning a number (as Voile did).But instead, now i just cast the result of
encoded
as String before comparing.So now overloading prototypes should be ok, as well as defining method outside of
encode
ordecode
.you are right
you want me to specify it in the kata description ?
i should never trust a copy-paste. Fixed
It should be fixed
Fixed by freezing String.prototype in preload
I added sample tests, but very basic.
I forgot to add
console
to the context. Now you can debug.Loading more items...