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

Implement map* and filter for ArrayView #1321

Merged
merged 4 commits into from
Dec 13, 2024

Conversation

gmlewis
Copy link
Contributor

@gmlewis gmlewis commented Dec 11, 2024

This PR is for discussion purposes.
It relates to #1013 and #1275.

I believe that it is MUCH more flexible for the map* functions to return an Array (instead of an ArrayView).
Then, code that was performing a map on an entire array could easily insert a [1:] and now map all but the first entry without modifying any other code.

Additionally, it is much easier to turn an Array into an ArrayView than to go the other direction.

@coveralls
Copy link
Collaborator

coveralls commented Dec 11, 2024

Pull Request Test Coverage Report for Build 4203

Details

  • 8 of 8 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.03%) to 80.85%

Totals Coverage Status
Change from base Build 4201: 0.03%
Covered Lines: 4509
Relevant Lines: 5577

💛 - Coveralls

/// ```
/// let v = [3, 4, 5]
/// let v2 = v[1:].mapi(fn (i, x) {x + i})
/// assert_eq!(v2, [3, 4, 6])
Copy link
Contributor

Choose a reason for hiding this comment

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

the CI failed because the test doc is incorrect

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry about that, @bobzhang !
I forgot about moon test --doc.
It should be fixed now.

Signed-off-by: Glenn Lewis <[email protected]>
@bobzhang bobzhang merged commit 7888115 into moonbitlang:main Dec 13, 2024
13 checks passed
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.

3 participants