Skip to content

Implement generic average#38

Merged
Jeehut merged 4 commits intoFlineDev:stablefrom
knothed:work/#36-generic-average
Sep 3, 2019
Merged

Implement generic average#38
Jeehut merged 4 commits intoFlineDev:stablefrom
knothed:work/#36-generic-average

Conversation

@knothed
Copy link
Copy Markdown
Contributor

@knothed knothed commented Sep 1, 2019

Implements #36. Adds a simple protocol DivisibleArithmetic (matching the Swift-style of AdditiveArithmetic and Numeric). Double, Float and CGFloat conform to DivisibleArithmetic, allowing to take averages from Arrays of all three types.

Additionally, when calculating the average() of an Int Array, you can choose the return type to be anything complying with DivisibleArithmetic (not just Double as before).

Copy link
Copy Markdown
Member

@Jeehut Jeehut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good. Could you please also add an entry to the changelog?

@knothed
Copy link
Copy Markdown
Contributor Author

knothed commented Sep 3, 2019

Yes, done!

@Jeehut Jeehut merged commit c9267a6 into FlineDev:stable Sep 3, 2019
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.

2 participants