## { y (Catalogue)

Combines items from the atoms inside a boxed list to form a catalogue.

```   { 0 1 ; 7 8 9
+---+---+---+
|0 7|0 8|0 9|
+---+---+---+
|1 7|1 8|1 9|
+---+---+---+```

### Common uses

Form the Cartesian Product of two lists, x and y

```   CP=: {@(,&<)   NB. example from Voc
0 1 CP 7 8 9
+---+---+---+
|0 7|0 8|0 9|
+---+---+---+
|1 7|1 8|1 9|
+---+---+---+```

Note: Table (/) has a similar action (and is the more usual primitive to use for this sort of thing)

```   0 1 (<@,"0)/ 7 8 9
+---+---+---+
|0 7|0 8|0 9|
+---+---+---+
|1 7|1 8|1 9|
+---+---+---+```

## x { y (From)

Returns the item with index x from the list y.

• Takes the place of indexing an array in other popular languages.

To replace item x in y, see: Item Amend }

```   z=: 'abcde'
1 { z
b
1 _1 { z
be
2 4 { z
ce```

From { also works with a matrix y (which is a list of lists).

In this case, x is a list of integers up to \$y in length.

```   ] z=: i.3 5
0  1  2  3  4
5  6  7  8  9
10 11 12 13 14
1 { z
5 6 7 8 9
verticalslice=: {"1
1 verticalslice z
1 6 11```

Note the use of < to exclude given indexes

```   (<<<_1) { z
0 1 2 3 4
5 6 7 8 9```

### Common uses

1. Convert from an ASCII code to the corresponding literal

```   65 97 { a.
Aa```

2. The Foreign: 5!:5 (Linear Representation) employs From ({) in its output to represent a non-printable character, e.g. Linefeed (LF).

```   linefeed=: LF"_
type 'linefeed'
+----+
|verb|
+----+
5!:5 <'linefeed'
(10{a.)"_```

### See Also

Vocabulary/curlylf (last edited 2013-11-19 01:44:30 by IanClark)