Skip to content

Conversation

chrisseaton
Copy link
Collaborator

@chrisseaton chrisseaton commented Dec 23, 2020

By Maple, but not pinging here as she's on leave.

Shopify#1

wildmaples and others added 4 commits December 23, 2020 17:02
Array#minmax was not implemented so it was deferring to
Enumerable#minmax, which iterates over the array. By implementing
Array#minmax, with #min and #max, performance is improved.
`Array#minmax` doesn’t support the `n` parameter in the same way that
`#min` and `#max` do, so we shouldn’t accept it here.

Before:

```
>> array = (1..10).entries
=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
>> smallest, largest = array.minmax(3)
=> [[1, 2, 3], [10, 9, 8]]
>> smallest
=> [1, 2, 3]
>> largest
=> [10, 9, 8]
```

After:

```
>> array = (1..10).entries
=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
>> smallest, largest = array.minmax(3)
ArgumentError (wrong number of arguments (given 1, expected 0))
```
@eregon eregon added the in-ci The PR is being tested in CI. Do not push new commits. label Jan 4, 2021
@eregon eregon self-assigned this Jan 4, 2021
@graalvmbot graalvmbot merged commit abbcb82 into oracle:master Jan 4, 2021
@chrisseaton chrisseaton added the shopify Pull requests from Shopify label Feb 2, 2021
@chrisseaton chrisseaton deleted the array-min-max branch August 30, 2021 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in-ci The PR is being tested in CI. Do not push new commits. oca-signed shopify Pull requests from Shopify
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants