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.
You're welcome. :]
Thanks for explanation and for help in this task. Best codeReview ever)
The technique is just recursive descent parsing. It can do right-associative operators too, but it requires a rule for every precedence level. If you have lots of different precedences, there are better ways, but they are overly complicated if you have few.
I stole the solution from someone else on another parser / evaluator kata.
Your algorithm is very elegant (i think). Is this a specific technique, does it have a name?
Because order of operations is defined. There can be no floating point representation error ( or, if there is, you're doing it wrong ).
This is the one exception to comparing floating point values with a margin for error.
Why not
assert.approximately
orassert.closeTo
?https://www.chaijs.com/api/assert/#method_approximately
I was too. :P
holy shit, I am... XD
Are you sure you're not modifying the input?
* one line of code.
Author, told you.
Of course you can't reproduce if you test with your own solution. That defines
config
. Mine doesn't ( why would it? ).`${input} is${expected ? "" : " not"} valid`,
should use
JSON.stringify
:`${ JSON.stringify(input) } is${ expected ? "" : " not" } valid`,
That would correctly show the input as an array. You're missing brackets and nesting now.
Testing should use
assert.strictEqual
.Random tests are vulnerable to input modification.
the random tests generate stuff like that:
[[2,22,9,-83,5],"-",[12,-36,-79,-43,39],"*",-41,"-","SQRT1_2"]
=>??? where are the functions or operators in the inner arrays?sidenote: as said below, this kind of kata won't leave the beta phase (too much of them already)
Loading more items...