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.
ok. I am not used to writing kata. I will follow the instructions throughly and rewrite it again later.
You give basically the entire algorithm to the user in the question initialization
The description is extremely vague and it isn't immediately obvious what the function's output should be
The sample tests are incorrect.
The actual tests only go up to 23 and hence no numbers that would return
Here is one!
appears.Also, there are no random tests.
nah this is more like a 7
This comment is hidden because it contains spoiler information about the solution
in progress :)
oh, i didn't know about that, thanks for the information
Can you explain why
if
accepts a predicate value instead of a thunk, whilefor
andwhile
predicates accepts a thunk? This is not how typical languages handleif
statements with side effects.It was never specified that multiple values can be in
_case
. This only occurs in the test cases.The question below should be an issue:
const
is only tested for direct assignment.(Also, I don't agree that
const
variables can be deleted. It'sconst
after all. In almost all languages you can't do this either.)Related: You only gave primitive examples of the expected behaviour in terms of a giant code block. This is not acceptable as kata specification.
For a proper language you need to specify the syntax of the language (what goes after what), what goes into each argument, the expected order of evaluation, etc. Otherwise this is more of a toy project than an actual kata.
There are no random tests.
The test setup is incorrect:
it
blocks in Mocha are run in async parallel, so you cannot depend on eachit
block running one after another.Each
it
block should create its ownLanguage
object from scratch and test from there.(Test frameworks that uses
describe
/it
structure in other languages also does this in general, btw)I think it's possible, because I didn't think that far ahead, in this KATA I just want to make it simple, not too complicated
Can variables be redefined from mutable to immutable and back? example:
lang.const.x(10);
lang.x // 10
lang.const.x(20);
lang.x // 10
lang.let.x(15);
lang.x // 15 or should it still be 10? and vice versa from let to const
im aware of how the javascript language works, but with regards to this language we're creating in the kata, it isn't clear how this should behave
i enjoyed the finger workout i got from scrolling through this answer
only thing that would make this better is nested ternaries