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.
Result is too short
is clearly not whatminimum viable items
, as stated by the test block, means, so it's just plain confusing. It's also a very roundabout and kinda unreliable way of testing the actual requirement of not folding constants.If you want to check constants are not folded, you'd at least need to reconstruct the AST and check if they're structurally equal. That's the only way.
Thanks! Fixed now
Fixed, only
generateTestCase
anddeepCopy
are exposed now.isInfix
was changed after the reference solution was changed.But there are still things other than
generateTestCase
that's leaking to user code space, such asinfixOps
andunaryOps
. These things should be IIFE'd.I'm not sure as to how I should do this with an IIFE - I need to access for example
generateTestCase
multiple times within the test script.Could you give me an example as to how I could solve this with iffys?
Should be fixed now
Reopened: (Initially posten by Voile)
If user has defined
isInFix
themselves they'll getSyntaxError: Identifier 'isInfix' has already been declared.
Should use an IIFE to isolate your preloaded helper functions so they don't pollute the user code scope.
Thank you very much for pointing this stuff out!
Fixed both of the last two bullets, but I can't reproduce the first one just yet
Funky stuff are happening to the tests at the moment:
ERROR: expectedSumAst is NaN but expectedSum is NaN! Our solution is wrong!
is thrown inside test code and the test failsInfinity
is expected there.replaceAll
is used by it's only supported by Node v15+; CW environment is Node v14 so it's throwing an errorNow if user has defined
isInFix
themselves they'll getSyntaxError: Identifier 'isInfix' has already been declared
.You should use an IIFE to isolate your preloaded helper functions so they don't pollute the user code scope.
Should be fixed now
It allows for more solutions to the kata. One solution may contain more expressions, but turn out to be the same answer.
You were right, I've modified my solution based on yours.
Btw:
Right. Could you show me this example solution which only uses two temporary variables?
Loading more items...