TYL PROGRAMMING LANGUAGE
▶ LISTS
Tyl List is an ordered collection of items.
List Variable Declaration
In Tyl programming, each variable has a name, for ex. 'book'. But if we want to declare a list of books, we would give it the name 'books', with letter 's' (or 'S') at the end, referred to as plural ending. The plural ending causes the system to recognize books as a list variable.

Here's books declaration:
books
Declaration of any variable in Tyl is done upon its first occurrency in the code, and its scope will span the rest of its containing block and all contained blocks thereafter:
showlist books
showlist items: items item ~ print item
In statement showlist books, books will be automatically declared, and then will be sent to showlist function as its first parameter.

Another way to declare a list is by appending square brackets to its name:
data [ ]
This type of declaration must be done if list name is not in plural ending style, and must be in its own line.

Tyl permits declaring some list variables in the same declaration line:
books cooks dooks
data actions results []
If one of the variables does not end with plural ending, the declaration line must end with square brackets, as done in the second line.

If we want to declare books list with some items, we would write them right after the variable name.

Here's books list declaration with three items:
books 'Tanamera', 'The Odyssey', 'Things Fall Apart'
Commas are not mandatory and can be omitted:
books 'Tanamera' 'The Odyssey' 'Things Fall Apart'
If list name does not end with plural ending, declaration items should be decorated with brackets:
data [ 'Tony' 22 1.71 \t ]
Note that the variables can be of different types, provided that they are all scalars.

If the declaration line has more than one variable, all variables will have the declaration items:
person1 person2 [ 'Tony' 22 ]
Declaration line of multiple list variables does not construct a list assignment. Each variable is declared and assigned the declaration items separately.
Adding/Removing Items
To add an item, write:
books <- 'The Postman Always Rings Twice'
Tyl Symbolizer will replace '<-' with the add item symbol '':
books 'The Postman Always Rings Twice'
A string variable with value 'The Postman Always Rings Twice', will be added to books after its last item, or as its first item if books is empty.

To insert an item at a specific position, append the position to the list name.

Inserting an item at the start of the list:
books 0 'The Postman Always Rings Twice'
In Tyl, items indexing is zero based indexing, meaning item positions are 0, 1, 2 ..., therefore the position at the start of the list will be 0.

Removing the item at the start of the list:
books ->
Tyl symbol for removing is the remove item symbol '':
books
The first item of books, will be removed.

Removing an item from specific position:
books 2
To remove all the items of a list, we use the double arrow notation:
books ->->
In symbols:
books
books list will be cleared.
Accessing Items
To access the item at the start of the list:
books 0
To access an item with position variable:
position 0
books position
position 2
books position
Editing Items
To edit the item at specific position:
books 2 'The Postman Always Rings Twice'
The third item of books list will get the value 'The Postman Always Rings Twice'.
PART 2