Ad
  • Custom User Avatar

    Just use

    (defn div? [d n] (zero? (mod n d)))

  • Custom User Avatar

    Lots of thanks for your kind answer!

  • Custom User Avatar

    See on the internet discussion about rounding or truncating. When I truncate I can be confident with the last digit, not when I round. Furthermore truncating was explicetly asked in the description (with the demanded numbers of decimals) to avoid constant arguing about rounding errors.

    You have n steps but n+1 points so it is natural to divide by this number even if it is supposed without error at y0. Anyway n+1 was given in the description.

    Besides that I will always pretend that it is better to have a general understanding rather than to have your nose to the ground:-)

  • Custom User Avatar

    There are some typos in example code (eg. curriedAdd(add)), and no unit tests. I realised the typo because I used the inline examples. Codewars is printing functions as empty strings, so found this particular mistake annoying and took me a while to debug.

    My bad; fixed.

    The repeated application of the function converter (curryParial(curryPartial(fn))), I found that tricky because of losing an easy way to read the original arity. Thought of setting some kind of property on function, but new to Python and wasn't sure how. See how now from other answers, but also quite a few people got lazy like me and just used exception handling instead. Not sure the value of handling this contingency anyway, since currying + variadic doesn't make much sense, and double application of currying would be a no-op and something to avoid.

    Not really sure how to help here. Do you think the description text should contain hints that link to places in the documentation where you can learn these things?