# where

Where

&x

**where** replicates each item in the domain of a list or dictionary as many times as the corresponding value (which is required to be a non-negative integer) in the range:

&1 0 1 4 2 0 2 3 3 3 3 4 4

For a boolean list it returns the positions of the truthy items:

&0 0 1 1 0 1 2 3 5

For an integer atom it generates that many zeroes:

&3 0 0 0

For a dictionary it uses the keys instead of indices:

&`a`b!2 3 `a`a`b`b`b

## Deep where[edit]

A non-standard extension in ngn/k works on matrices and higher-dimensional arrays. It returns the paths to truthy atoms as the columns of a matrix:

glider:(0 1 0;1 0 0;1 1 1) &glider (0 1 2 2 2 1 0 0 1 2)