-
Notifications
You must be signed in to change notification settings - Fork 195
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
feat(sdk): adding math module #3114
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: monada-bot[bot] <[email protected]>
…/wing into marciocadev/math-module
Signed-off-by: monada-bot[bot] <[email protected]>
…/wing into marciocadev/math-module
eladb
requested changes
Jun 29, 2023
Co-authored-by: Elad Ben-Israel <[email protected]>
Signed-off-by: monada-bot[bot] <[email protected]>
Signed-off-by: monada-bot[bot] <[email protected]>
eladb
approved these changes
Jul 2, 2023
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.
Great job!
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Congrats! 🚀 This was released in Wing 0.23.7. |
revitalbarletz
pushed a commit
that referenced
this pull request
Jul 3, 2023
I had a little trouble with the `min` and `max` because JSii didn't accept the methods to receive `Set<number>`. When I tried to use `number[]` and use it in the Wing code, it only accepted arrays. I ended up using `any`, but I wasn't very satisfied. @eladb, I took the liberty of adding a few more functions to the module, such as `round` and I noticed that you placed `random` and `randomInt` in the `Util` module, but I wonder if they should be part of the `Math` module instead. ```ts preflight inflight min(arr: Set<num>): num; preflight inflight max(arr: Set<num>): num; preflight inflight abs(value: num): num; preflight inflight floor(value: num): num; preflight inflight ceil(value: num): num; // adding to the specs preflight inflight math.PI; // PI constant preflight inflight math.E; // Euler's number preflight inflight isPrimen: num): bool; preflight inflight round(value: num, decimalPlaces?: num): num; preflight inflight median(arr: Array<num>): num; preflight inflight mode(arr: Array<num>): Array<num>; preflight inflight arithmeticMean(arr: Array<num>): num; preflight inflight geometricMean(arr: Array<num>): num; preflight inflight harmonicMean(arr: Array<num>): num; preflight inflight fibonacci(n: num): num; preflight inflight factorial(n: num): num; preflight inflight combinations(n: num, r: num): num; ``` ## Checklist - [x] Title matches [Winglang's style guide](https://docs.winglang.io/contributing/pull_requests#how-are-pull-request-titles-formatted) - [x] Description explains motivation and solution - [x] Tests added (always) - [ ] Docs updated (only required for features) - [ ] Added `pr/e2e-full` label if this feature requires end-to-end testing *By submitting this pull request, I confirm that my contribution is made under the terms of the [Monada Contribution License](https://docs.winglang.io/terms-and-policies/contribution-license.html)*.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I had a little trouble with the
min
andmax
because JSii didn't accept the methods to receiveSet<number>
.When I tried to use
number[]
and use it in the Wing code, it only accepted arrays.I ended up using
any
, but I wasn't very satisfied.@eladb, I took the liberty of adding a few more functions to the module, such as
round
and I noticed that you placedrandom
andrandomInt
in theUtil
module, but I wonder if they should be part of theMath
module instead.Checklist
pr/e2e-full
label if this feature requires end-to-end testingBy submitting this pull request, I confirm that my contribution is made under the terms of the Monada Contribution License.