Ad
  • Custom User Avatar

    🤣🤣 Brute force FTW!

  • Custom User Avatar

    I think you use too complicated ternar operators. It is difficult to read and understand logic.

  • Custom User Avatar

    OK, got it. I was running into an unexpected "feature" of reduce that I was unaware of.

    Inelegantly solved. Thanks for your help.

  • Custom User Avatar

    I thought it would count as an issue as it was giving an error message rather than simply telling me that the code failed a test. I don't get this error message in the REPL on my own machine so it seems to be particular to the site. But I take your point!

    I doubt that the reduce function is the issue, given that it passes all the random tests, but I'll try and alternative solution so see if that works better. Out of interest, how many tests are there under the should work for some examples section? I see four passing tests, then an error message, then all the random tests passing. Is it failing on the fifth test maybe?

  • Custom User Avatar

    First: when you are not sure if the problem comes from your code or from the kata, please post a question not an issue:-)
    Second: nobody else than I passed the F# translation. All I can say is that I pass the tests... Morever I use nowhere "reduce". So it could be your code when you use "reduce" in your function "convertFracts".
    Cheers.

  • Custom User Avatar

    I'm trying to do this kata in F#. My code passes the sample tests and all the random tests but it gives the following cryptic error message when doing the first part of the automated tests:

    at Microsoft.FSharp.Collections.ListModule.Reduce[T] (Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] reduction, Microsoft.FSharp.Collections.FSharpList`1[T] list) [0x00033] in <58dd0ce1dff9fae1a7450383e10cdd58>:0 
      at FSI_0001.convertFracts (Microsoft.FSharp.Collections.FSharpList`1[T] ls) [0x0001e] in <720d59d74cd84494a7b9368e1d8c4c7c>:0 
      at FSI_0001+Tests.testing (Microsoft.FSharp.Collections.FSharpList`1[T] ls, Microsoft.FSharp.Collections.FSharpList`1[T] exp) [0x00001] in <720d59d74cd84494a7b9368e1d8c4c7c>:0 
      at FSI_0001+Tests+suite@35.Invoke (Microsoft.FSharp.Core.Unit _arg1) [0x0022b] in <720d59d74cd84494a7b9368e1d8c4c7c>:0 
      at Fuchu.Impl+evalTestList@260-1.Invoke (System.Tuple`2[T1,T2] tupledArg) [0x00028] in <56a815db36d21f70a7450383db15a856>:0
    

    I can't tell from this if there is a problem with my code (an edge case I've not considered) or if there's a problem with the tests themselves. Can someone please clarify this?

  • Custom User Avatar

    Now that is a list of prime numbers !

  • Custom User Avatar

    Tests are locked anyway so nothing can be changed

  • Custom User Avatar

    That is true but the only difference it would make in most of these solutions would be a conditional to check if the element being iterated on contains non-characters,
    in which case a simple regex would solve the problem. So I wouldn't consider it that big of an issue.

  • Custom User Avatar

    Fixed, they're now all 1e-10.

  • Custom User Avatar

    why you think [ 1, 2, 3, 5, 6, 7, 88, 4455, 9927446 ] is incorrect?

  • Custom User Avatar

    Modified. Top-answer and second-from-top don't pass anymore. Nevertheless they are not invalidated?!

    Edit: now they are.

  • Custom User Avatar

    Note to author:

    JS version still has under 500 solves so it's possible to edit the tests. ;-)

  • Custom User Avatar

    The tests for JavaScript are incomplete and are accepting incorrect submissions. For example, if we try to calculate decompose (9927447), the second-from-top submission returns the incorrect answer [ 1, 2, 3, 5, 6, 7, 88, 4455, 9927446 ], the third returns the correct answer [ 1, 3, 17, 87, 4455, 9927446 ], while the top answer causes a stack overflow!

    I only discovered this after my incorrect algorithm was accepted, but the R version failed the unit tests.

  • Custom User Avatar

    Fixed.

  • Loading more items...