# How to find the index of the maximum value of an array that meets certain conditions

**URL:** <https://discourse.julialang.org/t/how-to-find-the-index-of-the-maximum-value-of-an-array-that-meets-certain-conditions/96477>\
**Category:** New to Julia\
**Created:** [March 22, 2023, 9:29pm UTC](https://discourse.julialang.org/t/how-to-find-the-index-of-the-maximum-value-of-an-array-that-meets-certain-conditions/96477 "2023-03-22T21:29:35Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![uniment](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/uniment/32/24532_2.png) [@uniment](https://discourse.julialang.org/u/uniment)\
**Post date:** [March 23, 2023, 8:41am UTC](https://discourse.julialang.org/t/how-to-find-the-index-of-the-maximum-value-of-an-array-that-meets-certain-conditions/96477/10 "2023-03-23T08:41:15Z")

</div>

> [@aplavin](#):
>
> Btw, a “positive” version of `skip` would be cleaner in these cases, but it’s not clear what name the function should have. It’s not `filter` because the semantics are different…

In [this comment](https://discourse.julialang.org/t/find-filtered-min-max-index/95154/20) I probe the idea that maybe this is a mistake.

Namely, the semantics of lazy `Iterators.filter`, which ignores the original collection’s indices, are based on an understanding of what “filtering” means informed by eager `Base.filter`, which conflates the idea of filtering with the act of collecting. However, if our starting point had instead been lazy filter, maybe this decision would have gone the other way—maybe the lazy filter would preserve the original collection’s indices.

Although, maybe the name `filter` is too tainted to go back now. That said, it’s not an especially informative name anyway—it doesn’t specify whether to keep or to discard the values for which the predicate returns true. In electrical engineering, we use the word `pass` to describe filters (e.g. band-pass filter, low-pass filter, etc.), but I’m finding myself enamored by @jar1’s suggestion of `keep`.

---

_[View the full topic](https://discourse.julialang.org/t/how-to-find-the-index-of-the-maximum-value-of-an-array-that-meets-certain-conditions/96477)._
