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.
This comment is hidden because it contains spoiler information about the solution
Fixed it... now your older solution shouldn't throw an "INTERNAL EXCEPTION" during testcases, but a normal error text message (tested it, but perhaps you can test it once again by removing "ToLower()" too;-))?!
Once again... found the problem, because my solution throws not an "ERROR..." it tries to compare your solution/result with my result, so it converts your result from string to double, which throws this Exception (your wrong "ERROR" message is no correct content for this conversion, only numbers - and the result should be a number here)... i will change my test next time for this unusual(?!) case.
Ok, thanks for your response, if there are other problems, please ask - or if you have suggestions to change things/testcases. The INTERNAL ERROR exception here is the "last error stage of the testcases", normally not used or needed - perhaps i have to take a look on it. Hope you can solve the kata, good luck;-)!
It's an exception during the tests while using your solution, perhaps you can send me your code and i will help you. You can do it here (mark as having spoiler content) or via email. Another way for you is to get the random generated input inside your function (output via Console.WriteLine(//input string//)) and to debug your solution once again using this input - i'm sure you will find an error. Give me a hint, what to do...
Here i can give you some random testcases which have to work (produced while using my own solution 5 minutes ago;-)), perhaps first you can check some cases. Didn't mark it as "having spoiler content", perhaps someone else wants to look at (it's random, so only an example which always differs)...
Expected: (-4--21e-3)&2 = 15.984004
-> Your Result = 15.984004 is accepted!
Expected: sin(cos(-2--21e+2)) = -0.839753238555368
-> Your Result = -0.839753238555368 is accepted!
Expected: sqrt(-14&(1+1--1+-1)) = ERROR: Formula / Calculation, Code=4
-> Your Result = ERROR: Formula / Calculation, Code=4 is accepted!
Expected: abs(1+(2-5)--5)* sin(3 + -5) / 2.1 = -1.29899632403669
-> Your Result = -1.29899632403669 is accepted!
Expected: (abs(1+(2--14)-3)* sin(3 + 5) / 2.1) &2 = 43.5035440071863
-> Your Result = 43.5035440071863 is accepted!
Expected: (Abs(1+(2--17)-3)* sin(3 + -17) / 2.1) -12.3453* 0.45+2.4e3 = 2386.42541259676
-> Your Result = 2386.42541259676 is accepted!
Expected: (((((17))))--1) = 18
-> Your Result = 18 is accepted!
Expected: (( ((( -2 ) ) ))-1) = -3
-> Your Result = -3 is accepted!
Expected: si n(-2)3 = ERROR: Unknown char
-> Your Result = ERROR: Unknown char is accepted!
Expected: SIN (-17)3 = 2.88419247563867
-> Your Result = 2.88419247563867 is accepted!
Expected: sin(cos(tan(1+2+-11-3-2-1--1))) = 0.780025885854676
-> Your Result = 0.780025885854676 is accepted!
Expected: (1+0+3))) = ERROR: Formula / Calculation, Code=3
-> Your Result = ERROR: Formula / Calculation, Code=3 is accepted!
Expected: (1+13+213) & 1e1 = 1.048576E+16
-> Your Result = 1.048576E+16 is accepted!
Expected: sqrt (1e-11e1)--1 = 2
-> Your Result = 2 is accepted!
Expected: (((sqrt (1e-11e1)+-13 = ERROR: Formula / Calculation, Code=3
-> Your Result = ERROR: Formula / Calculation, Code=3 is accepted!
Expected: sin(cos(-11--21e+2)) -sqrt(11&(1+1--1+-1)) = -10.232171400554
-> Your Result = -10.232171400554 is accepted!
Expected: (abs(1+(2--8)-3)* sin(3 + 5) / 2.1) &2 = 14.2052388594894
-> Your Result = 14.2052388594894 is accepted!
Expected: sin(cos(tan(1+2+-2-3-2-1--1))) -(-2--21e-3)&2 = -3.60135543575089
-> Your Result = -3.60135543575089 is accepted!
Expected: sin(cos(-2--21e+2)) = -0.839753238555368
-> Your Result = -0.839753238555368 is accepted!
Expected: (1+-20+2*-20) & 1e1 = 5.11116753300641E+17
-> Your Result = 5.11116753300641E+17 is accepted!
Expected: (((((14))))--1) = 15
-> Your Result = 15 is accepted!
Expected: (Abs(1+(2-3)-3)* sin(3 + 3) / 2.1) -12.3453* 0.45+2.4e3 -(( ((( 3 ) ) ))-1) = 2392.04545000257
-> Your Result = 2392.04545000257 is accepted!
Expected: (( ((( -18 ) ) ))-1) -sin(cos(--18--21e+2)) = -18.6720460059561
-> Your Result = -18.6720460059561 is accepted!
Expected: (Abs(1+(2--1)-3) sin(3 + -1) / 2.1) -12.3453* 0.45+2.4e3 -abs(1+(2-5)--1)* sin(3 + -1) / 2.1 = 2394.444615
-> Your Result = 2394.444615 is accepted!
Expected: (( ((( 14 ) ) ))-1) = 13
-> Your Result = 13 is accepted!
Expected: sin(cos(--2--21e+2)) = 0.557478446250505
-> Your Result = 0.557478446250505 is accepted!
Expected: sin(cos(tan(1+2+12-3-2-1--1))) (((((12))))--1) = 9.29909463303715
-> Your Result = 9.29909463303715 is accepted!
Expected: sqrt (1e-11e1)--4 = 5
-> Your Result = 5 is accepted!
Expected: (1+9+29) & 1e1 = 296196766695424
-> Your Result = 296196766695424 is accepted!
Expected: (abs(1+(2--11)-3)* sin(3 + 5) / 2.1) &2 (Abs(1+(2--11)-3) sin(3 + -11) / 2.1) -12.3453* 0.45+2.4e3 = 2255.26330956328
-> Your Result = 2255.26330956328 is accepted!
Updated.
This comment is hidden because it contains spoiler information about the solution
Thanks for pointing that one out Steve! Feel free to implement the table if you think it is more clear. This Kata is in collaboration mode.
Believe it or not, there is a relatively simple explanation, and it isn't that Javascript treats them differently. It's because of
Array.prototype.toString
, and how that string is subsequently coerced to a number.When necessary to perform comparisons between an object and a primitive, the object is coerced to a string using its
toString
method:[1,2] > 0
becomes"1,2" > 0
Now, if one side of a comparison is a number (or boolean), the other side is coerced to a number as well; otherwise, they're compared as strings. So:
"1,2" > 0
becomesNaN > 0
"1,2" > "0"
isn't changed, because neither side is a numberIf you change
Array.prototype.toString
, then an array such as[1,2]
can become any string you want it to become. E.g.Test case added, thanks
Thanks, for your words. I've refactored and simplified a bit my solution to the chainable methods. Hope you like it.
You're right, I added random tests and I have not noticed that the frequency may be the same for two values. I've solved it adding a comparison function that uses alphabetical comparison when frequency is the same.
Sorry, you're right. I changed a few things to improve the kata. Now I think it is finished and I do not expect significant changes.
Your solution is great by the way. I am also interested in the concept of monads.e But I am not able to understand where you have applied them.
About the specs, I have tried to make them increasing difficulty gradually. As to the
where()
function, you're right but would have to change all the examples.This comment is hidden because it contains spoiler information about the solution
Done. I am using chai.js on my laptop and it seems it uses the opposite format. Sorry, for inconvenience.
Loading more items...