Chapter 2 - Vectors and Lists Flashcards
1
Q
Vector
A
an ordered list of items. []
2
Q
Function to create a vector
A
(vector args)
3
Q
Function to count the number of items in a vector
A
count
4
Q
Function to get the first item of a vector
A
first
5
Q
Function to get all items of a vector, but not the first
A
rest
6
Q
Function to get a vector’s item by its index
A
nth
ex: (nth book-vector 3)
7
Q
Function to add an item to the end of a vector
A
conj (conjunction)
ex: (conj books “1984”)
8
Q
Function to add an item to the front of a vector
A
cons (constructor)
ex: (cons “Bhagavad Gita” books)
9
Q
List
A
an ordered list of items. ‘(1 2 3)
10
Q
Function to add an item to the front of a list
A
conj (conjunction)
ex: (conj books “1984”)