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





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





butlast, bl arg1





butfirst, bf arg1





last arg1





first arg1





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





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