Ad
  • Default User Avatar

    nice use of destructing in that for loop!

  • Custom User Avatar

    Just use

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

  • Custom User Avatar

    Clojure version's witheld tests assume a helper function "div?" exists, which was only revealed via stracktraces, and whose purpose and argument order had to be guessed.

    Example test cases would also improve the quality of the kata.

  • Default User Avatar

    Lots of thanks for your kind answer!

  • Custom User Avatar

    Thanks for the reply, well argued on each point. See now that n+1 does make sense if you think of it like an L1 norm.

    Generality is great - maths get only more sublime as it's abstracted. My critique was around needing to parse a long informal explanation to find the problem statement midway - at a glance I was first confused at how to integrate 'n', before realising I was not to write a general integrator or to return a curve or y value.

    Maybe I was just in too impatient a mood, thanks for an unusual problem and a constructive response

  • Default 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

    Notation is confusing - mixing X,Y and y,t co-ordinate labels. Probably easier to introduce the particular equation instantly rather than trying to define the general problem.

    Decision to truncate instead of round to 6 digits seems odd, and only examples made it clear that this really was what was wanted.

    Calculating average errors as sum / n+1 also seems odd, there will never be any error at y0, so sum / n makes more sense.

  • Custom User Avatar

    Python has already some and every functions, although named any and all.

  • Custom User Avatar

    Looking at latest answers, see how varied the solutions to get around the issue were. Eg. dudymas' use of a callable Class, or peatey using the function's internal name. Think finding a solution to the repeated application case is just "part of the fun" in the end.

    Perhaps a small paragraph about ambiguity when calling on variadic functions would be useful.

  • 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?

  • Custom User Avatar

    Needs some polish to make it out of beta for Python IMHO

    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.

    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.