Ad
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    I have a solution in Haskell that meets all of the test case requirements and which I think solves the kata, but when submitting the answer I get a traceback in whatever code is checking the solution.

    /tmp/haskell11671-14-v59wdo/Main.hs:17:9:
        No instance for (RealFrac Int) arising from a use of `sierpinsky'
        Possible fix: add an instance declaration for (RealFrac Int)
        In the first argument of `shouldSatisfy', namely `sierpinsky i'
        In the second argument of `($)', namely
          `sierpinsky i `shouldSatisfy` (== solution i)'
        In a stmt of a 'do' block:
          it (printf "sierpinsky %d" (i :: Int))
          $ sierpinsky i `shouldSatisfy` (== solution i) 
    

    Obviously this is due to my sierpinsky funciton using a type constraint not included in the function that checks the answer. I'm not sure how to go about solving this issue.

  • Custom User Avatar

    Yeah, I think that will make it much clearer. I know I misread it the first time, but with the new example, there's no chance of that now.

  • Custom User Avatar

    The only improvement that I can see is that it could be made learer in your example and writing that the value / weight ratio is what the greedy algorithm should use to sort the items.

    The example made it seem like the raw value was the only thing concerning the knapsack picker.

  • Custom User Avatar

    I do not know what this is doing, but I like it.