### A.4 Operations on lists

 word word1 word2

Concatenates the two words word1 and word2.
Eg: pr word "a 1 returns a1

 list arg1 arg2

Returns a list composed of arg1 and arg2.
For example, list 3 6 returns [3 6].
list  “a “list returns [a list]

 sentence, se arg1 arg2

Returns a list composed of arg1 and arg2. If arg1 or arg2 is a list, then each element of arg1 and arg2 will become an element of the resulting list (square brackets are deleted).
Eg: se  [4 3] “hello returns [4 3 hello]
se  [how are] “things returns [how are things]

 fput arg1 list2

Insert arg1 in the first slot in list2.
Eg : fput  “cocoa [2] returns [cocoa 2]

 lput arg1 list2

Insert arg1 in the last slot of list2.
Eg: lput  5 [7 9 5] returns [7 9 5 5]

 reverse list

Reverse the order of elements in list.
reverse  [1 2 3] returns [3 2 1]

 pick arg1

• If arg1 is a word, returns one of the letters of arg1 at random.
• If arg1 is a list, returns one of the elements of arg1 at random.

 remove arg1 list2

Remove element arg1 from list list2 if it occurs there.
Eg: remove  2 [1 2 3 4 2 6 ] returns [1 3 4 6]

 item n arg2

• If arg2 is a word, returns the letter numbered n from the word (1 represents the first letter).
• If arg2 is a list, returns the element numbered n from the list.

 butlast, bl arg1

• If arg1 is a list, returns the whole list except for its last element.
• If arg1 is a word, returns the word minus its last letter.

 butfirst, bf arg1

• If arg1 is a list, returns the whole list except for its first element.
• If arg1 is a word, returns the word minus its first letter.

 last arg1

• If arg1 is a list, returns the last element of the list.
• If arg1 is a word,returns the last letter of the word.

 first arg1

• If arg1 is a list, returns the first element of the list.
• If arg1 is a word,returns the first letter of the word.

 setitem, replace list1 n arg3

Replace the element number n in the list list1, by the word or the list arg3.
replace [a b c] 2 8 –-> [a 8 c]

 additem list1 n arg3

Adds at the position n in the list list1 the word or the list arg3
additem [a b c] 2 8 –-> [a 8 b c]

 count arg1

• If arg1 is a word, returns the number of letters in arg1.
• If arg1 is a list, returns the number of elements in arg1.

 unicode word1

returns the Unicode value of the character word1.
pr unicode "A returns 65

 character,char n

Returns the character which Unicode value is n.
pr character 65 returns "A