# Putting things together

This section contains all commands that put together Logo words or lists, or access elements of Logo words or lists.

## FPUT

Prepends an element to its input.

#### Syntax

```FPUT word word
FPUT word list
FPUT list list```

#### Description

FPUT reports the word or list that is created by putting the first input at the beginning of the second input. If both inputs are words, FPUT reports a word; otherwise it reports a list. See also `LIST`, `LPUT`, `SENTENCE`, and `WORD`.

#### Example

```FPUT "A "BC
Result: ABC
FPUT 1 23
Result: 123
FPUT "A [GREEN CHEVY]
Result: [A GREEN CHEVY]
FPUT [NORTH DAKOTA] [NEW HAMPSHIRE]
Result: [[NORTH DAKOTA] NEW HAMPSHIRE]
```

## ISEQ

Outputs a list of sequential integers.

#### Syntax

```ISEQ from to
(ISEQ from to increment)```

#### Description

ISEQ outputs a list of the integers from FROM to TO, inclusive. If an increment is given as an optional third input, the integers are created using the given increment; if no increment is given, the increment is 1 if FROM is less than TO, or -1 if FROM is greater than TO. Note that if the increment is not 1 or -1, the TO value may not be part of the list; for example, the output of (ISEQ 1 5 3) would not contain the value 5, because the next value to add would have been 6 instead of 5.

#### Example

```ISEQ 5 10
Result: [5 6 7 8 9 10]
ISEQ 10 5
Result: [10 9 8 7 6 5]
(ISEQ 5 10 2)
Result: [5 7 9]
```

## LIST

Concatenates its inputs to a list.

#### Syntax

```LIST object1 object2
(LIST object1 object2 object3 ...)```

#### Description

LIST reports a list composed of its inputs. The inputs to LIST can be either words or lists. If the inputs to LIST are themselves lists, LIST preserves them as lists. LIST expects two inputs, but can accept more or less if it and all its inputs are enclosed in parentheses. See also `FPUT`, `LPUT`, `SENTENCE`, and `WORD`.

#### Example

```LIST "NORTH "CAROLINA
Result: [NORTH CAROLINA]
LIST [TO BE] [OR NOT TO BE]
Result: [[TO BE] [OR NOT TO BE]]
```

## LPUT

Appends an element to its input.

#### Syntax

```LPUT word word
LPUT word list
LPUT list list```

#### Description

LPUT reports a new object that is created by placing the first input at the end of the second input. The inputs to LPUT can be either words or lists. If the first input is a list, the second cannot be a word. If both inputs are words, LPUT reports a word. See also `LIST`, `FPUT`, `SENTENCE`, and `WORD`.

#### Example

```LPUT "ISSIPPI "MISS
Result: MISSISSIPPI
LPUT FIRST [X Y Z] [A B C D]
Result: [A B C D X]
```

## PARSE

Parses a string and outputs a list.

#### Syntax

`PARSE word`

#### Description

PARSE reads its input and converts it to a list.

The Listener procedure that Logo uses to evaluate user input is roughly written as:

```TO LISTENER
LISTENER
END```

#### Example

```PARSE "|hi world|
Result: [HI WORLD]
PARSE "|(a b c)|
Result: [(A B C)]
```

## RSEQ

Outputs a list of equally spaced rational numbers.

#### Syntax

`RSEQ from to count`

#### Description

RSEQ outputs a list of COUNT equally spaced rational numbers between FROM and TO, inclusive.

#### Example

```RSEQ 4 5 6
Result: [4 4.17 4.33 4.5 4.67 4.83]
```

## SENTENCE (SE)

Concatenates its inputs to a list, flattening lists.

#### Syntax

```SENTENCE object1 object2
(SE object1 object2 object3 ...)```

#### Description

SENTENCE reports a list made up of its inputs. SENTENCE expects two inputs, but will accept more if it and all of its inputs are enclosed in parentheses. If the inputs to SENTENCE are lists, their brackets are removed and combined into one list. See also `FPUT`, `LPUT`, `LIST`, and `WORD`.

#### Example

```SENTENCE "NICEST "MONTH
Result: [NICEST MONTH]
SENTENCE [APRIL IS THE][NICEST MONTH]
Result: [APRIL IS THE NICEST MONTH]
```

## SUBST

Substitutes text in a word or a list.

#### Syntax

`SUBST what with wordorlist`

#### Description

SUBST performs a replacement of text in its arguments. It replaces all occurrences of its first input with its second input inside the word or list given as its third input. If the third input is a list, the replacement is recursive and affects all lists inside the list. If the list element to be replaced is quoted, the replaced text remains quoted. In the same way, leading colons are preserved.

#### Example

Quotes and colons are preserved.

```SUBST "JUNK "NEW [A JUNK BOX]
Result: [A NEW BOX]
SUBST "? "X "A?B?C
Result: AXBXC
SUBST "? "MIKE [HELLO ? [HOW ARE YOU ?]]
Result: [HELLO MIKE [HOW ARE YOU MIKE]]
```

## WORD

Concatenates its inputs to a word.

#### Syntax

```WORD object1 object2
(WORD object1 object2 object3 ...)```

#### Description

WORD contatenates its inputs, which must not be lists, to a single word.

#### Example

```WORD "NICEST "MONTH
Result: NICESTMONTH
```