4 kyu
Curry me softly
388sirRodge
Loading description...
Functional Programming
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Also, where are the random tests?
Dammit, I missed that. Two years and nobody flagged it. (I was worrying about other things, as mentioned below.)
Care to write some?
1AM here, so I don't think I'll be doing it right now.
Idea: Do normal Array/String/RegExp/Date/etc stuff with random prototype functions using the curry function and randomized inputs.
This part is very unclear and confusing as to how the kata expects you to handle the context.
For the sake of other people's sanity: The kata expects you to handle the context by retrieving the context at the first time the initialized function is called. Everything after is not used.
20 People managed, of which half voted they were Very satisfied. I was more worried it was called currying, but wasn't.
I'll edit in your addition.
Further question: Should we reset the context too after calling the wrapped original function without arguments?
In reply to your original comment, not your last (we were posting simultaneously): Also mentioned in the very last comment, BTW. Description updated satisfactorily?
Closing.
Leaving this for the original author to decide. He knows what he wants (supposedly).
The whole context thing is a mess of course. I have no clue what he intended. (Taking the cowardly out here .. :P )
I have approved this kata with a big caveat at the top that what is asked for is not currying, and I have wrapped uses of the term "currying" in quotes where it does not conform to the accepted definition.
Maybe we can call the process described here, which, if not strictly currying, is interesting .. "currying softly" !? :yum:
haha long time since I looked at this, thank you for feedback
yes at the time I wrote this I was learning what currying was and was actually wrong as you said. I do still think it's interestng though :)
will think about how to rephrase
@sirRodge, I'm not an expert on functional programming either, but I think curry is misused and therefore causing confusions. Your kata is asking us to implement a function which returns a partially applicable function wrapping given function preserving the original execution context.
This requirement contradicts with the definition of currying.
Ah got it, yes i realize now that what im asking for is actually like an ES6 generator and that currying sticks with these pure functions like you've described, will fix
Handling of
this
is described very vaguely. This kata still has the best description among all currying katas on codewars %-)Okay I tried to add some color to the handling of "this"
Thank you for your feedback :)
should be resolved
The whole idea is pretty strange. Currying usually appears in context of pure function. At the same time conditions require us to have some hidden state. So the task of having such impure stateful currying is an oxymoron.
Honestly I made this Kata to learn and am no expert on functional programming, is this not how currying kindof has to work in javascript (functions being first class citizens means multiple invocations necessarily produces intermediate functions)?
I don't know another way it could but would like to see some sort of quick mock-up or if you could point me to an example of what you think is better.
Oh I think I see, you would return a new function each time? So that the original function was not modified each time it is run?
If so, I think this is better, I'm wondering if it works to change it since it would make everyone's answers wrong haha.
This comment has been hidden.
This comment has been hidden.
Okay, I tried to clarify the "this" handling, thanks!
should be resolved
This comment has been hidden.