-
-
Notifications
You must be signed in to change notification settings - Fork 95
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
Remove extraneous combinators #330
Conversation
index.js
Outdated
//. | ||
//. See also [`C`](#C). | ||
//. This is the `C` combinator from combinatory logic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Three minor points:
-
In this context C should not be rendered as code. The description of
I
, for example, simply states:The I combinator.
-
The sentence should end with a full stop (
.
). -
We don't mention combinatory logic in the descriptions of the other combinators, but it seems reasonable to do so here given that
flip
is not listed in the Combinator section.
I suggest:
This is the C combinator from combinatory logic.
//. > Z.map(S.flip(Math.pow)(2), [1, 2, 3, 4, 5]) | ||
//. [1, 4, 9, 16, 25] | ||
//. > S.flip(S.concat, 'foo', 'bar') | ||
//. 'barfoo' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
index.js
Outdated
@@ -806,13 +776,16 @@ | |||
//. In general terms, `compose` performs right-to-left composition of two | |||
//. unary functions. | |||
//. | |||
//. See also [`B`](#B) and [`pipe`](#pipe). | |||
//. This is the `B` combinator from combinatory logic. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments about the C combinator above.
59075cb
to
a82f202
Compare
//. Takes a binary function and two values, and returns the result of | ||
//. applying the function to the values in reverse order. | ||
//. Takes a curried binary function and two values, and returns the | ||
//. result of applying the function to the values in reverse order. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's append this sentence to the paragraph:
Equivalent to Haskell's flip
function.
We do this for several other functions, and it seems helpful for those coming from Haskell.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've only done that for functions where the name in Sanctuary differs from the name in Haskell. Are you sure we want to do it for flip
, which maps to .. flip
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha, fair point. It may not add value. The type signature already indicates that the function takes three arguments (unlike Ramda's version which takes just one).
I leave it to you to decide whether or not to include the sentence. I'm happy either way. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's leave it this way. Once we go down this road we may feel the urge to document how every function relates to Haskell. I'll save us that trouble. ;)
index.js
Outdated
@@ -806,13 +776,16 @@ | |||
//. In general terms, `compose` performs right-to-left composition of two | |||
//. unary functions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could simplify this description. The first paragraph is overly wordy. What do you think of the following?
Composes two unary functions, from right to left. Equivalent to Haskell's (.)
function.
That says it all, really.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not really related to this PR, but I'm happy to make that change. ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not really related, that's true, but an issue entitled "improve all function descriptions" is too daunting to consider. We can at least make small improvements as they occur to us. :)
index.js
Outdated
//. | ||
//. See also [`B`](#B) and [`pipe`](#pipe). | ||
//. This is the B combinator from combinatory logic. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep the link to pipe
:
See also pipe
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh dear. Good catch. ⚡
67f215d
to
eebb9c2
Compare
Once #216 is merged we'll be left with |
Implications for #216
map
beingB
toS.map
documentation.S.S
in favor ofS.ap
and add a note to its documentation.join
beingW
toS.join
documentation.Implications for the future
Maybe we should rename the remaining combinators to their full names.