Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
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.
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
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.
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.
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.