Synopsis Indexing of a relation via tuple values.
Syntax
1. `Exp0 [ Exp1, Exp2, ... Expn]`
2. `Exp0 [ Exp1]`
Types

## Variant 1

`Exp0` `Exp1` `Exp2` ... `Exp0 [ Exp1, Exp2, ... ]`
`rel[T1, T2, ... Tm]` `int` `int` ... `rel[Tn, Tn+1, ... Tm]`

## Variant 2

`Exp0` `Exp1` `Exp0 [ Exp1 ]`
`rel[T1, T2, ... Tm]` `set[T1]` `rel[T2, T2, ... Tm]`
Description Relation resulting from subscription of a relation `Exp0`.

## Variant 1

Subscription with the index values of `Exp1`, `Exp2`, .... The result is a relation with all tuples that have these index values as first elements with the index values removed from the tuple. If the resulting tuple has only a single element, a set is returned instead of a relation. A wildcard `_` as index value matches all possible values at that index position.

## Variant 2

Subscription with a set of the index values of `Exp1`. The result is a relation with all tuples that have these index values as first element with the index values removed from the tuple.
Examples
```rascal>R = {<1,10>, <2,20>, <1,11>, <3,30>, <2,21>};
rel[int,int]: {
<1,11>,
<3,30>,
<2,21>,
<2,20>,
<1,10>
}
rascal>R;
set[int]: {10,11}
rascal>R[{1}];
set[int]: {10,11}
rascal>R[{1, 2}];
set[int]: {10,11,20,21}
rascal>RR = {<1,10,100>,<1,11,101>,<2,20,200>,<2,22,202>,
>>>>>>>              <3,30,300>};
rel[int,int,int]: {
<3,30,300>,
<2,22,202>,
<1,11,101>,
<1,10,100>,
<2,20,200>
}
rascal>RR;
rel[int,int]: {
<11,101>,
<10,100>
}
rascal>RR[1,_];
set[int]: {100,101}
```
Introduce a relation with economic data and assign it to `GDP`:
```rascal>rel[str country, int year, int amount] GDP =
>>>>>>>{<"US", 2008, 14264600>, <"EU", 2008, 18394115>,
>>>>>>> <"Japan", 2008, 4923761>, <"US", 2007, 13811200>,
>>>>>>> <"EU", 2007, 13811200>, <"Japan", 2007, 4376705>};
rel[str country,int year,int amount]: {
<"US",2007,13811200>,
<"US",2008,14264600>,
<"Japan",2007,4376705>,
<"Japan",2008,4923761>,
<"EU",2008,18394115>,
<"EU",2007,13811200>
}
```
and then retrieve the information for the index `"Japan"`:
```rascal>GDP["Japan"];
rel[int,int]: {
<2008,4923761>,
<2007,4376705>
}
```
or rather for the indices `"Japan"` and `2008`:
```rascal>GDP["Japan", 2008];
set[int]: {4923761}
```

Questions
Question .  Using the above example with GDP values:
`GDP["US"] == `

Question .  Using the above example with GDP values:
`GDP["US",2008] == ` Is this page unclear, or have you spotted an error? Please add a comment below and help us to improve it. For all other questions and remarks, visit ask.rascal-mpl.org.