6 kyu

Combinator Flip

3,394 of 3,428JTipp
Description
Loading description...
Functional Programming
Fundamentals
  • Please sign in or sign up to leave a comment.
  • laurelis24 Avatar

    I think there something wrong with the tests. Would be nice to know what function "rev" does. Ps. Well there was more than 2 arguments... Didn't know.

  • donaldsebleung Avatar

    This comment has been hidden.

    • Voile Avatar

      You're already 6k so you can edit this published kata, and it's not >500 solves either.

  • Libert Avatar

    hi everyone, I don't have a very high level of Javascript (at all) and it's the first time I see something like "flip(print)(4,5)" ... I don't understand what is (print), why the function is not just flip(4,5) ? Some could explain pretty please ? The fact that there are 2 parentheses after the function is confusing to me.

  • wthit56 Avatar

    Can't get too far in this kata, with the "Value is not what was expected" messages. They're not that useful for debugging code. Particularly, I'm trying to pass the second test. I've replicated the test, and pass it fine, so can't figure out why I'm not passing the real one.

    • wthit56 Avatar

      Would really like some help on this; I've got most of the way there...

    • LDeleuran Avatar

      Are you trying to solve this using eval? I am currently (unsuccessfully) attempting such a solution.

    • wthit56 Avatar

      You can do. I've gone the new Function route, myself.

    • JTipp Avatar

      I revised the testing methods to Test.assertEquals. If you're still having trouble finding a solution please let me know. I'll be checking this kata everyday. I don't want to spoil the solution. I will say that of all the solutions I've seen, none of them involve the methods you guys have just mentioned.

    • wthit56 Avatar

      This comment has been hidden.

  • Azuaron Avatar

    For you test cases, you should use:

    Test.assertEquals(actual, expected, "Failure message");
    
    • JTipp Avatar

      Thanks, yeah I am new to making katas. I wasn't sure how the testing library works.

    • wthit56 Avatar

      Still getting a the unhelpful "Value is not what was expected" messages. Would love some help on this so I can complete the kata. As a hint, try using the form Test.assertEquals(resultingValue, expectedValue, message);, as this will at least give a hint of what the problem may be.

    • JTipp Avatar

      Hey wthit56, sorry I've taken so long to respond, I've had a busy month and totally forgot about this kata. I changed the tests from Test.expects to Test.assertEquals.

      Hopefully it will make it easier to revise your solution. The solution is quite simple, I'm sure you will get it. I'd rather not say much about it until you try it out using the new test methods. If you still have trouble I will give a better example.