Skip to content
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

Link from function to function #97

Open
tomek-he-him opened this issue Jun 5, 2015 · 2 comments
Open

Link from function to function #97

tomek-he-him opened this issue Jun 5, 2015 · 2 comments
Milestone

Comments

@tomek-he-him
Copy link
Member

#94 (comment)

I think we’d need to link between functions that do more or less the same thing, but take a different number of parameters.

@stoeffel
Copy link
Contributor

stoeffel commented Jun 7, 2015

How about we add a @see tag to the jsdoc?

i.e.

/**
 * @module 1-liners/curry
 *
 * @description
 *
 * Curry a function – split its list of parameters into 2 lists.
 *
 * @see curryRight
 * @see uncurry
 * @see uncurry3
 * ...
 */
### curry

Curry a function – split its list of parameters into 2 lists.

```js
 import curry from '1-liners/curry';
 import reduce from '1-liners/reduce';
 import compose from '1-liners/compose';

 // You can use reduce and compose to create curry3,4 and so on.
 const curry3 = compose(curry, curry);
 const curry4 = reduce(compose, [curry, curry, curry]);

 const f = (a, b, c, d) => a * b * c * d;
 const fβ = curry(f);  // ~= curry2
 const fγ = curry3(f); // ~= curry3
 const fδ = curry4(f); // ~= curry4

 f(1, 2, 3, 4)  === 24

 fβ(1)(2, 3, 4) === 24
 fβ(1, 2)(3, 4) === 24
 fβ(1, 2, 3)(4) === 24

 fγ(1)(2)(3, 4) === 24
 fγ(1)(2, 3)(4) === 24

 fδ(1)(2)(3)(4) === 24

Related functions

SpecSource: (f) => (...a) => (...b) => f(...a, ...b);

@tomek-he-him
Copy link
Member Author

I’d rather keep it minimal like:

Related: curryRightuncurryuncurry3

But definitely 👍 to that!

@tomek-he-him tomek-he-him modified the milestone: 1.0.0 Jun 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants