# CoCoA:In

## In

create a list satisfying given conditions

### Description

In the first form, E is an arbitrary CoCoA expression and B is a

boolean expression, both of which are functions of the variable

X. Write E(X) for E and B(X) for B. The first listed command then returns the list of all E(X) such that X is in the list L and B(X) evaluates to TRUE.

#### Example

```[[X^2,X^3] | X In [-2,-1,0,1,2] And X &lt;&gt; 0];
[[4, -8], [1, -1], [1, 1], [4, 8]]
-------------------------------
[X In [1,2] &gt;&lt; [2,3,4] | X[1]+X[2]=4];
[[1, 3], [2, 2]]
-------------------------------
```

(Note: the <formula>><</formula> operator is used to form Cartesian products; it is not the same as the not equal operator, <formula><></formula>.)

The second form of the command is the same as the first with E = X.

#### Example

```[X In [1,2,3] | X &gt; 1];
[2, 3]
-------------------------------
```

The third form is the same as the first with B = TRUE.

#### Example

```[X^2 | X In [1,2,3]];
[1, 4, 9]
-------------------------------
```

### Syntax

```[E:OBJECT | X In L:LIST And B:BOOL]:LIST
[X In L:LIST | B:BOOL]:LIST
[E:OBJECT | X In L]

where X is a variable identifier which may occur in B or E.
```

```   <type>list</type>
```