Skip to content

feat: add Curry function #646

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

feat: add Curry function #646

wants to merge 1 commit into from

Conversation

lanathlor
Copy link

Hello.
This commit introduces a set of CurryN functions to transform standard multi-argument functions into curried form. Each CurryN takes a function with N parameters and returns a nested chain of unary functions that can be called one argument at a time.

Example:
Curry3(func(x, y, z int) int { return x + y + z }) → func(int) func(int) func(int) int

These utilities follow the functional programming style established in the library and can be found on other TS libs like lodash or ramda.

Here we are limited by go and we need to implement it manually for all arity (or at least i didnt found a workaround)

Added Curry(2..5) functions to allow partial application of functions with multiple arguments.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant