-
-
Notifications
You must be signed in to change notification settings - Fork 94
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
Implement S.add and S.sub #133
Implement S.add and S.sub #133
Conversation
90e9689
to
847db85
Compare
//. 2 | ||
//. ``` | ||
S.add = | ||
def('add', |
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.
⬅️ ⬅️
847db85
to
609b121
Compare
Is there value in using the same names as sanctuary-int, do you think? We use |
Yeah, I guess it doesn't do any harm to be consistent. I was just following the naming convention from Ramda. |
609b121
to
f9f574d
Compare
[$.FiniteNumber, $.FiniteNumber, $.FiniteNumber], | ||
function(a, b) { return a + b; }); | ||
|
||
//# subtract :: FiniteNumber -> FiniteNumber -> FiniteNumber |
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.
s/subtract/sub/
Could you update the commit message and pull request title to match? :)
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.
Way ahead of you. 😉
f9f574d
to
8703e97
Compare
8703e97
to
324419f
Compare
errorEq(TypeError, | ||
'‘sub’ expected a value of type FiniteNumber ' + | ||
'as its second argument; received "xxx"')); | ||
}); |
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 would be nice to use an infinite number in one of these tests. ∞
324419f
to
fbbd2e9
Compare
|
||
//# add :: FiniteNumber -> FiniteNumber -> FiniteNumber | ||
//. | ||
//. Adds two finite numbers together. |
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.
For the descriptions, I like:
- Returns the sum of two (finite) numbers.
- Returns the difference between two (finite) numbers.
fbbd2e9
to
ea196e9
Compare
⚡ x 3 |
//. Returns the sum of two (finite) numbers. | ||
//. | ||
//. ```javascript | ||
//. > S.add(1, 1); |
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.
s/;//
ea196e9
to
f2f1cd3
Compare
f2f1cd3
to
ee92e3e
Compare
⚡ x 2 |
🌳 |
Implement S.add and S.sub
As discussed in #127 .