[Question]
  [
The \$\text{argwhere}\$ function takes a list of values and a predicate/boolean function as arguments and returns a list of indices where the predicate function returns true in the input list. For example,
```
argwhere([1, 2, 3, -5, 5], x -> x > 2)
```
would produce an output of `[2, 4]` because those are the (0-indexed) indices whose values are greater than two.
## Challenge
Implement the \$\text{argwhere}\$ function in your language of choice.
## Format
For the purposes of this challenge, we will deal with lists of integers. You must accept a list of integers and a [black box function](https://codegolf.meta.stackexchange.com/questions/1324/standard-definitions-of-terms-within-specifications/13706#13706) and return a list of integers in [any reasonable format](https://codegolf.meta.stackexchange.com/questions/2447/default-for-code-golf-input-output-methods). You may assume the input list will never be empty. Your output may be either 0-indexed or 1-indexed ‚Äî please specify which.
## Rules
* Builtins are allowed, but please consider adding a less trivial answer so we can see how \$\text{argwhere}\$ might be implemented in your language.
* Explaining your answer(s) is encouraged!
* [Standard loopholes](https://codegolf.meta.stackexchange.com/questions/1061/loopholes-that-are-forbidden-by-default) are forbidden.
* This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the code with the fewest bytes (in each language) wins.
###### Why argwhere?
argfoo is a naming convention where you don't want the elements themselves ‚Äî you want their indices or some other quality. \$\text{argmax}\$, \$\text{argmin}\$, and \$\text{argsort}\$ are examples of this. Read more about it [here](https://stackoverflow.com/questions/22679684/why-is-argsort-called-argsort). (Also, because my favorite programming language comes with this function and it's called `arg-where`. ü§´)
## Test cases
0-indexed
| Input | Output |
| --- | --- |
| 
```
[1, 2, 0, 0, 3, 0, 0, 0, 4], x -> x == 0[4, 3, 5, 7, 11, 13, 17], x -> x % 2 == 0[8, 9, 10, 11, 12, 13], x -> x + 10 > 20[5, -5, 2, -2, 0], x -> x < 0[5, 2, 0], x -> x < 0
```
 | 
```
[2, 3, 5, 6, 7][0][3, 4, 5][1, 3][]
```
 |
1-indexed
| Input | Output |
| --- | --- |
| 
```
[1, 2, 0, 0, 3, 0, 0, 0, 4], x -> x == 0[4, 3, 5, 7, 11, 13, 17], x -> x % 2 == 0[8, 9, 10, 11, 12, 13], x -> x + 10 > 20[5, -5, 2, -2, 0], x -> x < 0[5, 2, 0], x -> x < 0
```
 | 
```
[3, 4, 6, 7, 8][1][4, 5, 6][2, 4][]
```
 |
 
  
[Answer]
# [Python 3.8 (pre-release)](https://docs.python.org/3.8/), 45 bytes
```
lambda l,F:[i for i,e in enumerate(l)if F(e)]
```
[Try it online!](https://tio.run/##K6gsycjPM7YoKPqfZhvzPycxNyklUSFHx80qOlMhLb9IIVMnVSEzTyE1rzQ3tSixJFUjRzMzTcFNI1Uz9n9BUWZeiUaaRrShjpGOARAag0kDHZNYHahJFVYKFQq2tgoGmpr/AQ "Python 3.8 (pre-release) ‚Äì Try It Online")
Looks like it won't get much shorter than this.
Explanation: keep all indexes (found by unpacking; the index is the first item of each 2-element tuple in the return value of `enumerate`) for which the function returns `True` for the corresponding element.
[Answer]
# [Haskell](https://www.haskell.org/), 28 bytes
```
p!v=[i|(i,x)<-zip[0..]v,p x]
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/v0CxzDY6s0YjU6dC00a3KrMg2kBPL7ZMp0ChIvZ/bmJmnm1BUWZeiYqGnaGhpmK0pZ6eoUXsfwA "Haskell ‚Äì Try It Online")
## Explanation
To get the indices we `zip` the list with the natural numbers `[0..]`. Then we use a list comprehension to get only the correct indices.
[Answer]
# [R](https://www.r-project.org/), 24 bytes
```
function(x,f)which(f(x))
```
[Try it online!](https://tio.run/##jc/RCsIgFMbx@57iuxkonYHaxopl7xIyczcLRjEhenZTaXTjIDgXCv5/eOZwnW@LG@ZBB/uczGO8T8yT5YsbjWOWec6D14ZJgiKIPIf1EKfhPaz@pfzloTXEu8cqZ2@XkCa3LaEjyCjKeJNdQagqqG3mSDjFUHwRlaACso9PcIEqI/EXdZuXqtNihf6MzfL/InwA "R ‚Äì Try It Online")
Uses [R](https://www.r-project.org/)'s built-in `which` function, which is pretty-close to `argwhere` except for the manner in which `x` and `f` are supplied...
---
# [R](https://www.r-project.org/), 26 bytes
```
function(x,f)seq(!x)[f(x)]
```
[Try it online!](https://tio.run/##jc/RCsIgFMbx@57i62Kg5EBtY8WyF4kuYszqZpEVCdGz21Ea3TgIzoWC/x8eFw7u@Dz1rjfBPobufr4MzAvLb/2VzT3fWeb5PnjTMSWgBWSa5XigqXgLa34xf3kYA/luMdpJnEWkSm0t0AgoEhXdVJMRigJ6mlkJrCmUX0RHKIMs6Am20HmEflHWaakyLpbpN5gs/y/CBw "R ‚Äì Try It Online")
Roll-your-own version without any built-in.
Note that many/most [R](https://www.r-project.org/) functions vectorize, and this is assumed here (and indeed applies to all the test-cases). However, this isn't universal, so if `f` is a non-vectorizing function we'd need [+7 bytes](https://tio.run/##K/qfWJRenpFalGr7P600L7kkMz9Po0InTbM4tVBDsUIzujixoCCnEiwU@7/CNlnDUEfBSEfBAIyMYQwgMtG0VkizRZihWV2hYGurYFBrrQCzAmwKF8gQE7BeUx0Fcx0FQ6CJhkCeoTkWE1RVFYxwG2Oho2AJ1GgANcQIZBAWQ7SBShTsFIywGwJ0ha4p2FO6II9h0W@jgFMn8Tr@AwA): `function(x,f)seq(!x)[sapply(x,f)]`.
[Answer]
# [Raku](http://raku.org/), 13 bytes
```
{grep :k,|@_}
```
[Try it online!](https://tio.run/##K0gtyjH7n1upoJamYPu/Or0otUDBKlunxiG@9n9xYqVCmoaWgo2CgY6CjamCrqmCkYKukYKBneZ/AA "Perl 6 ‚Äì Try It Online")
Raku's `grep` filtering built-in can return matching indices instead of matching values if given the adverb `:k`. This is just an anonymous function that adds `:k` to the arguments it's given and passes them all to `grep`.
Raku's function objects actually have an `assuming` method that returns a new function with some of the arguments to the original function fixed in advance, so this code would more idiomatically be written `&grep.assuming(:k)` or the even terser `&grep.assuming:k`, but that's too long for golf.
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), 2 bytes
```
MT
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyIiLCJgWzgsIDksIDEwLCAxMSwgMTIsIDEzXWBFXG7OuzEwKzIwPjsiLCJNVCIsIiIsIiJd)
100% pure ascii. 0-indexed
## Explained
```
MT
M  # Map the function to the list
 T # and return indicies where the result is truthy
```
[Answer]
# [JavaScript (V8)](https://v8.dev/), 34 bytes
```
a=>f=>a.map((x,i)=>f(x)&&print(i))
```
[Try it online!](https://tio.run/##hc7RCoIwFAbg@57iJ0h2aIZbioZtl75EdDGCYEEhJuLbr@MqEBKCw9hh/3d2bm5wz0vn2z4dqtCY4Iy9Gut2d9cKMUpP3IuRkqTt/KMXnijUq0aclISWyGLtvxeu/EwCI4ydDoOMarzlek0R5jFfSJQSiqco7lQ5UxvoZVlJHDibfZye7Mxt@QkW@hfyZ2kR902nnWfmiMX0n1R4AQ "JavaScript (V8) ‚Äì Try It Online")
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), 4 bytes
Full program. Prompts for array, then function.
```
‚ç∏‚éï¬®‚éï
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///qKO94P@j3h2P@qYeWgEkQAL/FcCggAvI9wr291OPNtRRMNJRMAAjYxgDiExi1bmqDRRsFR71bq0FannUO1ehQkHXDkjY2ioYcGEYZALWb6qjYK6jYAg01RDIMzSHmWKkUIPFJFWgOHbTLHQULIH6DaBmGYHMA5llZKBgAxRW0MZimjZIwk7BCItxQGfpmoJ9qgvyLcRVdljMsFHArpugLgA "APL (Dyalog Unicode) ‚Äì Try It Online")
`‚ç∏`‚ÄÉwhere
`‚éï`‚ÄÉthe function
`¬®`‚ÄÉmapped to
`‚éï`‚ÄÉthe array
[Answer]
# Java 8, ~~74~~ 73 bytes
```
f->a->{for(int i=0;i<a.length;i++)if(f.test(a[i]))System.out.println(i);}
```
-1 byte thanks to *@Unmitigated*
0-based. Outputs the indices on separated newlines to STDOUT.
[Try it online.](https://tio.run/##1ZJdS8MwFIbv9ysOBaGhaWg7x9R@gAjCLkRhl2MXsU1rZpeWJp0bo7@9Zu1EkA109EYCIck57znnecmKbqi9St7bOKdSwhPlYj8CkIoqHsNKR0mteE7SWsSKF4I8Hg/BidhLxRIeU8WCmVAsY1WET2Q9FELWa1YFXKjFMooghrBN7Yja0T4tKlM/Aw8dnweU5Exk6s3nloV4aqZEMalMuuBLhOY7qdiaFLUiZaU1uTA58pvWH@n5y/o11/MfMTYFT2Ct0cy50qnZYgm0yiQ6kAJ0YwCFEAT76G97F3vY0Wvc7Q6@bvwu90RTYybKWsk7MKxv2PuqojtJVNE3NCmyDKAigW0YOgY6X@y5VrqaLnbM@ZXLkOrht3Z0KN7LYkLLMt@ZKSI0jlmpTTvfFHWWwQ8LrjX8BE@x62J3jN3pYA5ceX/04IuuEw7Gd4Nvset0eJ4mHAzPcp3Iu4ivVw4GOMH2RH9jW//kweCCi8CCIaH@Lw5AM2raTw)
**Explanation:**
```
f->a->{              // Method with Function & integer-array parameters and no return
  for(int i=0;i<a.length;i++)
                     //  Loop `i` in the range [0,length):
    if(f.test(a[i])) //   If the Function for the `i`'th integer of the array is truthy:
      System.out.println(i);}
                     //    Print index `i` with trailing newline
```
[Answer]
# [Pari/GP](http://pari.math.u-bordeaux.fr/), 20 bytes
-9 bytes thanks to @Joe Slater. Didn't know that `select` can take a flag.
```
(a,g)->select(g,a,1)
```
[Try it online!](https://tio.run/##Zc7dCoMwDAXgVzkIg5alYDvFDaYvIl4EURHKKOqFe/qudT@9GOQi4XwJcbzManJ@RO0F0yRVsw526DcxEZOWnp2zT8FQDdwyP7bQZnHI0LO1YiSwlIS2bTXBEPKjLt8mVNER9riyo66RdxEXBykJFUGHRR0mXSV4gkn4SriFOP9QE3mi55CggXnbcFKVxyMqPpPYHT/wH3TSvwA "Pari/GP ‚Äì Try It Online")
---
# [Pari/GP](http://pari.math.u-bordeaux.fr/), 29 bytes
```
(a,g)->[i|i<-[1..#a],g(a[i])]
```
[Try it online!](https://tio.run/##Zc7dCoMwDAXgVzk4Bi1LxbqJG6gvUnoRBkpBRpFdONi7d6376cUgFwnnS4jnxanJhxF9EEyTVINxT9cpo8tyx5YmwcZZaQN7Pz8EQw3wi7vdY1ukocCV51mMBJaSYIzRhJpQbXX8NrFOlrCmlRV9j8omfNpIQ2gJOi7qOOk2wz3qjM@ES4yrD60Tz/QQEwyo3zaeVM32iErPZNbhB/4DK8ML "Pari/GP ‚Äì Try It Online")
[Answer]
# [Ruby](https://www.ruby-lang.org/), 35 bytes
```
->a,f{(0..a.size).select{f[a[_1]]}}
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m72kqDSpcsGiNNulpSVpuhY3lXXtEnXSqjUM9PQS9Yozq1I19YpTc1KTS6rTohOj4w1jY2troUpVChTSoqMNdYx0DIDQGEwa6JjE6ujaVVRXKNjaKhjUxkLULlgAoQE)
[Answer]
# Haskell + [hgl](https://gitlab.com/WheatWizard/haskell-golfing-library), 19 bytes
```
(cx<ixm pM).^m<m gu
```
## Explanation
Here's the same code converted to a more convenient format:
```
f q x =
  cx $ ixM pM $ m (gu q) x
```
To start we have `gu` which takes a boolean and produces `[]` if false and `[()]` if true.
We map `gu q` across the input list, this converts things that pass the test to `[()]` and things that fail to `[]`.
`pM` takes a list and a value and replaces everything in that list with that value. `ixM` is an index map. It combines every element with its index using some function. Here we use `pM` as the function so that our `[()]`s get replaced with `[index]`.
Then `cx` concats everything back together.
You can reorganize things a bit to get:
# 19 bytes
```
cx.^ixm<(pM^.)<m gu
```
Which is equivalent to
```
f q x =
  cx $ ixM (\x y -> pM x $ gu $ q y)
```
But this is also 19 bytes so nothing is saved.
There is also:
# 19 bytes
```
(st.^^fl<fm cr)^.eu
```
This solution uses an entirely different set of tools to solve the problem but is the same length.
This can be translated to the more conventional
```
f q x =
  m st $ fl (q < cr) $ eu x
```
First `eu` pairs every element with its index in the list. Then `fl (q < cr)` filters using `q` on the second element of each pair. Finally `m st` gets all the indices from the remaining list.
[Answer]
# [Husk](https://github.com/barbuz/Husk), ~~5~~ 4 bytes
*Edit: -1 byte thanks to Razetime*
```
`fNm
```
[Try it online!](https://tio.run/##yygtzv7/qKnx3G47IwNtQ4NHjRs0/yek@eX@//8/2kLHUsfQQMfQUMfQSMfQOBYA "Husk ‚Äì Try It Online")
Razetime already pointed-out in the comments that [Husk](https://github.com/barbuz/Husk) has a one-byte built-in for `argwhere`: the `where` or `W` function.
So this is an implementation without `W` or any other function that acts-on or returns indices.
```
`f     # filter (select the elements that satisfy a condition)
  N    # the natural numbers
       # using this list to represent yes/no:
   m   # map 
       # the black-box function provided as (implicit) argument 1
       # across all elements of (implicit) argument 2
```
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 18 bytes
```
Position[1>0]@*Map
```
[Try it online!](https://tio.run/##bY3BCoJAEEDvfoWw4KFG2FkVC1LsAwSjo3hYTGkPulF7G/TXt0UTIpqBubzHvEGaezdIo1pp@8xW@qWM0mONOW@KXSkftnqq0dQszPuiYE0wX1s5zuQRyzIegP8ZQhDA3UbL5RBPE3hU6lvNQDSrS7HDCaSACBgBpovD9shzsf2iAxwB@aIIZ63K6SvlUwJh4nKhK/7HGzgbPVzgF3iTfQM "Wolfram Language (Mathematica) ‚Äì Try It Online")
Input `[f, list]`. Returns a list of 1-indexed `{index}`s.
Finds the positions of `True`s when the function is mapped onto the list.
---
### [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 13 bytes
```
Position@_?#&
```
[Try it online!](https://tio.run/##bY3BCsIwDEDv@4pBYBczaLuNKbhZP0CY51JkqMMetoL2FvrttWwOREwgl/fIG3v3uI@9M9c@DE3o7Ms4Yyd5OUAWuqeZnCIAn7eDAq1AaJ1JKSkhaBqWYfoZ4iiQxS3my7D0HhM62ZsCFHpxqYy4who5R14gr2cHNpy1Yv1FW9whZ7MiorUo@69UShXmVczlsfgfr@Do7HjGX5D48AY "Wolfram Language (Mathematica) ‚Äì Try It Online")
Input `[f][list]`. Returns a list of 1-indexed `{index}`s.
Finds the positions of elements that satisfy a predicate - basically a built-in. However, this can possibly include the index of the head of the expression (`{0}`) if the predicate returns `True` when applied to that head (`List`).
[Answer]
# [Nim](http://nim-lang.org/), 60 bytes
```
proc a[S,F](s:S,f:F):S=
 for i,x in s:
  if f x:result.add i
```
[Try it online!](https://tio.run/##NY07CsMwEAV7n@KVEizB@VQLglS@gErjQrEtsuB4g2SDbq84gcAUU82s8qr1nXRE6D11g8nsKXJn2bsGUROECmRF5gaQiIjCac77sp3CNEHqPD4Vwdz7M@FCaH9c/3JwGwjfgyl8hDbLeKgucChwDq2tHw "Nim ‚Äì Try It Online")
[Answer]
# [Pip](https://github.com/dloscutoff/pip) `-xp`, 7 bytes
```
bMa@*:1
```
Takes a list and a function that returns 0 (falsey) or 1 (truthy) as command-line arguments. Uses 0-indexing. [Attempt This Online!](https://ato.pxeger.com/run?1=m724ILNgebSSbkWBUuyCpaUlaboWy5N8Ex20rAwhPKjgTcVopWgLa0trQwNrQ0NrQyNrQ-NYJR2l6kRtQwM7I4NauHYA)
### Explanation
```
b        ; Second argument (the function)
 M       ; Mapped to each element of
  a      ; First argument (the list)
   @*:   ; Find all indices of
      1  ; 1 (truthy)
```
[Answer]
# [tinylisp](https://github.com/dloscutoff/Esolangs/tree/master/tinylisp), 84 bytes
```
(d w(q((L F N)(i L(i(F(h L))(c N(w(t L)F(a 1 N)))(w(t L)F(a N 1)))L
(q((L F)(w L F 0
```
The second line is an anonymous function that implements argwhere; the first line is a helper function. Uses 0-indexing (though it could just as easily be 1-indexing; simply change the number on the second line). [Try it online!](https://tio.run/##XY6xDsIwEEN3vsKjb0tSKmDq1qnqCmsgEUQqBdoKBD9fjoqhoJMiy37n3JDaZ5P66zgy4MEbWaFELUyomFjyhEqEB9R8cFBd0qOGFTX/jWqhHdtvh8b4VJmRzcUHNGnf@e4pC25B/XGAhYPRyabXYCl4xe5SzJClhjlWsBY2g10J4j22c2KNDayZAKeMqO3P@@DB3UfHvi/gDOhDcNgpqnfO1nOwjUfkordMygmMQJUf0j0WP6j7jcY3 "tinylisp ‚Äì Try It Online")
### Explanation
The helper function `w`, in addition to `L` (the list) and `F` (the function), gets an extra argument `N` (the current index). Its logic boils down to:
* If `L` is nonempty:
	+ If the result of calling `F` on the `h`ead of `L` is truthy, `c`ons `N` to the front of a recursive call to `w` with arguments:
		- `t`ail of `L`
		- `F`
		- `a`dd 1 to `N`
	+ Else, just do the recursive call
* Else, return `L` (empty list)
The anonymous function calls `w` with an initial index of 0.
[Answer]
# [Julia 1.0](http://julialang.org/), 16 bytes
```
l/f=findall(f,l)
```
[Try it online!](https://tio.run/##bY7RCsIwDEXf/Yr7IrTYsrZuTMHuR8SHgRQqochQ2N/XrChWJoSQkHOS3J4URzvnTE3wIabrSCSCIpnvU0wPSgJnq@AUTIn9p@BoL43ADD1w8h5Gys1XagvbKfQKljdY7mxfGVu4tXVQODJn3o5bvMrZ8QgD3K/ER3RXftTLnxV/wor8S@QX "Julia 1.0 ‚Äì Try It Online")
Boring builtin, just change of order of parameters, let's move on. (The answers are all 1-indexed, by the way.)
### [Julia 1.0](http://julialang.org/), 18 bytes
```
l/f=findall(f.(l))
```
[Try it online!](https://tio.run/##bY7RCsIwDEXf/Yr7IrTYurZuTMHuR8SHgRQqoYgo7O9rVhQrE0JIyDlJrk@Ko51ypib4ENNlJBJhK0jKfLvH9KAkcLIKTsGU2H0KjvbcCEzQAyfvYaRcfaW2sJ1Cr2B5g@XO9pWxhltae4UDc@btuNmrnA2PMMD9SnxEd@VHPf9Z8UcsyL9EfgE "Julia 1.0 ‚Äì Try It Online")
This looks very similar, but works differently and shows off Julia's generalized broadcasting feature: `f.(l)` automatically maps `f` over each element of `l`, collects the results into an Array, type-infers that to be as a `BitVector` (a 1-D array of booleans), and passes that on to `findall`. This single argument version of `findall` accepts only arrays of booleans, and returns indices where there are `true` values.
### [Julia 1.0](http://julialang.org/), 21 bytes
```
l/f=axes(l)[1][f.(l)]
```
[Try it online!](https://tio.run/##bY7dCsIwDEbvfYrvRmixdW3dmILdi5Re7MLBpIzhD/Tta1YUKxNCSMg5Sa7PMPY6phSqwfbxcmeBO@3dsKfCp/k2To8wMTgtYARUjsOnoKh9xRAhO0rWQnG@@Up1ZhuBVkDTBk2dbgtjC7O2jgIn4tTbMYtXODsaoYP5leiIbPKPcvmz4M9YkX@J9AI "Julia 1.0 ‚Äì Try It Online")
Even avoiding `findall` altogether, the answer isn't too much longer!
`axes(l)` returns the indices in each dimension of `l`. Here since `l` is one dimensional, we take `axes(l)[1]` which gives the indices of the list. On that, we use [Logical indexing](https://docs.julialang.org/en/v1/manual/arrays/#Logical-indexing): As seen above, `f.(l)` returns an array of booleans. When we use that to index within the list of indices, we get back the indices where the function `f` returns `true`.
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), 43 bytes
```
x=>y=>x.reduce((a,b,i)=>y(b)?[...a,i]:a,[])
```
[Try it online!](https://tio.run/##NYhBCsIwEAC/kuMurEurnoSNDwk5bNNUIqWRtkr6@hgEYRiGeepHt7Cm135a8hjrJLWIPcQWXuP4DhFAaaCEbcKAd8fMSsnflJzHGvKy5TnynB8wgevJnMl0Py7/aFw9QjFiTZOYDrF@AQ "JavaScript (Node.js) ‚Äì Try It Online")
0-indexed, takes input in curry format f(array)(function)
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 6 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
Œ¥.V∆∂0K
```
The input black-box function is a string. 1-based.
[Try it online](https://tio.run/##yy9OTMpM/f//3Ba9sGPbDLz//w/RNjJ41LCLK9pCR8FSR8HQAIgNgdgIiI1jAQ) or [verify all test cases](https://tio.run/##yy9OTMpM/V9Waa@k8KhtkoKSfWVC8f9zW/TCjm0z8P6v8z86WileSSfaUMdIxwAIjcGkgY5JbKyOQrTS4Q6gnAlQ1FTHXMfQUMfQWMfQHCIVom1k8KhhF1DeQsdSx9AALG0EVAGRBsrtBMqZ6uiaAo3WBZqOJg4WiQUA).
**Explanation:**
```
Œ¥       # Map over the (implicit) second input-list,
        # using the first (implicit) input-string as argument:
 .V     #  Evaluate the string as 05AB1E code
   ∆∂    # Multiply each item by its 1-based index
    0K  # Remove all 0s
        # (after which the result is output implicitly)
```
[Answer]
# [Python 3](https://docs.python.org/3/), 45 bytes
```
def f(L,F,t=0):F(L[t])and print(t);f(L,F,t+1)
```
[Try it online!](https://tio.run/##hZFfa9swFMXf9SkujFKbKsF2kmZLlsIeaiiErZT2yZiiRfIm5kjCuh3Op8@uLDuUvswI68@9v3OObHfC39YszmepGmiSPS857rJ0Uyb7CutUGAmu0wYTTLdj@SZPz/robIfgT56xT1DaDlB51OYXh6M9/IkMNG/mgNoaQAtCymGCVnsEbTwqIcE2sZVIsG/Inu6/7V8fnx6@P8MuVtiPl@fHl7CtahZCxjh9umEAsTYXzikj6YyxhqK02ihyCOnmHqU2oXX/6rHjUMZJ9U4dUMmwI@mjcAmtqLvTjg8Cc@9ajcn19jpNA05d6q9ok0EnnJR00orjTymg38TaIF4tN3WoTxYT@N6Sgk7h48UAsDuFmBB/QhQ4KIfwYKTq77vOdrHuhPe0oPHuYyWT2O7iy0eD9FzlHAoO2TAW04LGsoYtQA@zO3oRmkF86LAqhtYVh1sO65pVy2m/5pCTYE67fF2P7aPGFRSTTtDIiPvM4Qt1ZiNVBLK@2IzcDTXAHRRZ5Eia7FZEk99sNaSfhRuM4Af66yX4QJPNIqIfkf@i9T8 "Python 3 ‚Äì Try It Online")
A function that prints the indices to STDOUT and terminates with an error.
[Answer]
# [Desmos](https://desmos.com/calculator), 34 bytes
```
a=[1...l.length]b(l)
f(l)=a[a<1/0]
```
\$b(l)\$ is the inputted black box function, which you will need to change for each test case (Desmos doesn't support inputting functions as arguments). \$f(l)\$ is the argwhere function. The output will be 1-indexed.
Further details in the graph links.
[Try It On Desmos!](https://www.desmos.com/calculator/cmv1jhnh15)
[Try It On Desmos! - Prettified](https://www.desmos.com/calculator/dyanvc3doi)
[Answer]
# [C (gcc)](https://gcc.gnu.org/), 85 bytes
1-based.
Takes an integer array with a length and a function taking an integer.
```
m;f(s,l,p)int*s,p();{putchar(91);for(m=l;l--;s++)p(*s)&&printf("%d,",m-l);puts("]");}
```
[Try it online!](https://tio.run/##bZLLboMwEEX3fMWIKpFNTIUhNI0c8gVRd11FLBCExhIPi0cVKeLb6dhJ0wgqGT/m3DszFk7drzQdx1LkpGUFU1RWndMyRai4qr5Lz0lDtpyKvG5IGRWicF3RrlZUEaely6VqUJ8Te5Exm5VuQQWaWmLHNhXD@CKrtOizE@zaLpP163lvWagHxYleLhSu0Jy6vqngsvcFDDfqz2kUeQ8czPHCfxas54IV9/b@nyKcK3aGGlwmsiLftcyQWwA65MhjHOkDgLYeY3rlDHwGAQM3ZBAO7B/omRH8bnCsJ7q1wZhgw4CjieOJbyaidwZbDHt3ia9lE0l4awORq@vO6VP04/NwwM3AoHhcKjQlsIk3001w44mw7vcnjsJEhN7lCvtQmFJhuwrvoEL9aZNx6MeS6B8ij0ksIMH3Ymw50QFdV88KZyqsYfwB "C (gcc) ‚Äì Try It Online")
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), 34 bytes
```
x=>y=>x.flatMap((b,i)=>y(b)?i:[]);
```
[Try it online!](https://tio.run/##y0osSyxOLsosKNHNy09J/Z9m@7/C1q7S1q5CLy0nscQ3sUBDI0knUxMoppGkaZ9pFR2raf0/OT@vOD8nVS8nP10jTSPaUEfBSEfBAIyMYQwgMonV1KhQsLVTABK2Cgaamv8B "JavaScript (Node.js) ‚Äì Try It Online")
```
f = x => y => x.flatMap((b, i) => y(b) ? i : []);
console.log(f([1, 2, 0, 0, 3, 0, 0, 0, 4])(x => x == 0))
console.log(f([4, 3, 5, 7, 11, 13, 17])(x => x % 2 == 0))
console.log(f([8, 9, 10, 11, 12, 13])(x => x + 10 > 20))
console.log(f([5, -5, 2, -2, 0])(x => x < 0))
console.log(f([5, 2, 0])(x => x < 0))
```
[Answer]
# [tinylisp](https://github.com/dloscutoff/Esolangs/tree/master/tinylisp), 48 bytes
```
(load library
(d A(q((L F)(all-indices(map F L)1
```
[Try it online!](https://tio.run/##VY7BCsIwEETv/Yo57h6EJFqqp9KLp36A12iCBNKoTRHqz8e1B7W7sAw7b2CmkOYY8r0UijfrEMN5tONckUNHD6IeRyYb4yYkFy4@02DvOKJnXagDSXSChoGS3S5XYcd4@fHWcvVFdmLWaKA19Ba6YfinT//EHgdotQBGGJa3Hc7Ogk4f7XNuYRTIOmdwEpRlfvEalPwVNUuXRRmGYoiyU3j6doWatVXe "tinylisp ‚Äì Try It Online")
The `library` unsurprisingly contains some rather useful functions for golfing; not sure if this should be scored as `tinylisp + library`. Takes the test harness from [DLosc's answer](https://codegolf.stackexchange.com/a/241431/67312).
[Answer]
# [Ruby](https://www.ruby-lang.org/), 31 bytes
```
->a,f{a.zip(0..){f[_1]&&p(_2)}}
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m72kqDSpcsGiNNulpSVpuhb7de0SddKqE_WqMgs0DPT0NKvTouMNY9XUCjTijTRrayGqbmqmRUcb6igY6SgY6yjomuoomMYCabuK6go7o9pYBWUFWzuFaKCsSSxEw4IFEBoA)
[Answer]
# [K (ngn/k)](https://codeberg.org/ngn/k), ~~12~~ ~~10~~ ~~9~~ 6 bytes
```
{&x'y}
```
[Try it online!](https://ngn.codeberg.page/k#eJxLs6pWq1CvrOXiSos2srE2VDBSMFYwUTCNBfIN7cB8XSAyVtAFCxnYgoUMgNAYTBoomMQCACIADpE=)
*Down 3 bytes thanks to Steffan*
Takes `x` as black box function and `y` as list of integers.
Explanation:
```
{&x'y}  Main function.
  x'y   Apply each value y to x (x(y)), return a binary list
 &      Get all the truthy indices
```
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 2 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
Black box function is pre-assigned to variable V.
```
√∞V
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&header=Clh7WD4y&code=8FY&input=WzEsIDIsIDMsIC01LCA1XQ)
[Answer]
# [Fig](https://github.com/Seggan/Fig), \$2\log\_{256}(96)\approx\$ 1.646 bytes
```
TM
```
[Try it online!](https://fig.fly.dev/#WyJUTSc+KzEweDIwIiwiWzgsOSwxMCwxMSwxMiwxM10iXQ==)
The `'>+10x20` bit in the link is the function \$f(x) = x + 10 > 20\$.
```
TM # Takes a function and a list in any order
 M # Map the list by the function
T  # Return the truthy indexes of the resulting list
```
[Answer]
# [J](http://jsoftware.com/), ~~13~~ 11 bytes
*2 bytes saved thanks to [Razetime](https://codegolf.stackexchange.com/users/80214/razetime)'s approach of using `I.`*
```
1 :'I.u"+y'
```
[Try it online!](https://tio.run/##jdBRC4IwFAXg9/2KQxAWTtmWw5L0oSAIoodeQyJCil6CIDLov9uZWGZPwRw6d757ueeqF3r76/F@Kq4F0gQeJBQSPkGI@Wa1qDQSbxneev7Dq4ZClO5WLsR6FmKrJQzv12v0fuGKcokSQcYtTaFEcThdMFBIUQ7xKadhWEdhVO8KUaNGNWYlYgnNEppfOm7JPnM/rMGzQ0dELWLGmWa4kccSE1qqcY2zW9fnH2Qwb9goTN2R36HHmLhDJxvGG5ndBraeRuAm0qLTrz6zDmSxs2x8xyG0yP9hxqoX "J ‚Äì Try It Online") Assumes the given predicate is a true boolean predicate, which yields `1` for truthy and `0` for falsey, as is standard in J.
I don't think there's a tacit way to make an adjective as complex as this. Technically, as per [standard IO](https://codegolf.meta.stackexchange.com/questions/2447/default-for-code-golf-input-output-methods/13707#13707), we can have ~~8~~ bytes by assuming the function is stored in a predefined variable `u`:
```
[:I.u"+
```
## Explanation
Approach c/o Razetime:
```
I.u"+y
  u      the given boolean function
   "+    applied at each cell of
     y   y, the input list
I.       obtain indices where truthy
```
Old approach:
```
u"0#i.@#
    i.     the indices from 0 to
      @#   the length of the input, right-exclusive
   #       and keeping only the elements corresponding to
u          the given boolean function
 "0        applied to each cell of the input
```
[Answer]
# [Go](https://go.dev), 85 bytes
```
func(f func(int)bool,L[]int)(A[]int){for i,e:=range L{if f(e){A=append(A,i)}}
return}
```
[Attempt This Online!](https://ato.pxeger.com/run?1=hZLRSsMwGIXBO_sUPwMhZam03cqmWKH3u_DGK_EibmkNrmkN7RyUPok3RfCh5tP4J2lBsVQIJKHfOefPoe8fWdGd5iXbvrCMQ86EdEReFqqCS5ileTVznANTwFT29swVh_izrlJvfbpPa7klKZhNyMp9Koo93Tw86jNJ7N6khQJB-XWsmET7TSNQQbjbJDErSy53JKHCbVtH8apWsrXmX2fnOjOrQohtwBGGiMaScIRbCFszG3_1p7g4Bt-CO3GYdLyA8AeN8ZO-cwh8PUSPS55N0Tfa1tGfTcnEhca5U8jtJRnKJRhJTXNNQCGksKDgRRSi1nX_wvjsX7Bv1mI44FqO6nQLvXBpeExYUQjQJcBbsBpV6TZ61ZrCFXJ-rwm1blSDlfSSyD4EUU9P-j89UP0f0XV2_wY)
# [Go](https://go.dev), generic, 90 bytes
```
func g[T any](f func(T)bool,L[]T)(A[]int){for i,e:=range L{if f(e){A=append(A,i)}}
return}
```
[Attempt This Online!](https://ato.pxeger.com/run?1=hZLBSsQwEIbx2qcYFoQEU2m7W3YVK_S-Bw89WXqIu2kJbtMa2mWl9Em8LIJP4ZPouwhO2i6olAoDk8D3_5P5yctrVhzfS7555JmAnEtlybwsdAWXMEvzavZWV6m9-rhPa7WBLI6Aq-eEpGDuJKIPRbFj6ziJKAnjRKqKNmmhQTJxHWiu0HPdSKSJoE0Y8LIUaktCJmnbWlpUtVZtP-Hz7GvPNWSVB0FvfgBjZwY0PQkHuAWvtQwnnpwpLgjA6cGt3E86noP3g8bxk74X4DrmEQOuRDZF3xhbq0vOJEsoNNadRm6nSBZjTwgOZF1ujcvAYzBnYPsM_JbSvyiu_At1upqfDliLEZXZf5AtOhrdlwxc9HDx5i5HNCaFQbNicIWUMyg8oxpRYBCDwO8XQNA2b_yPPTHDLzge-_4N)
]