Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Lecture 8

• You can use a function as input for another function- it is very powerful
• P = (x, y) or P = (x, y, z) are one point
• Similarly, record = (AshokaID, phone, photo, media) is a coherent object
• Such objects are usually known as tuples
• A topic is an object itself, it is not a list
• A list is more like L = [P1 , P2 , P3 ] where Pn are similar objects
• Theoretically they are different but you can use list for everything if you
want to
• In most languages you can’t edit individual items in tuples
• Empty list is an int list
• intList = int × list is an int list (This means you can take any list and
you can add an integer to it)

Another concept:
• A={1,2,. . . ,10}
• B={12,13,14,15,16}
• In f (a, b) there are A × B unique possibilities
• Int list is often called αlist

Another concept:
• int × αlist → αlist - attatch, append (takes single integer and attatches it
infront of a list)
• αlist → T /F
• αlist+ → int - head (take out first term)
• αlist+ → αlist - tail (take out first term and present the rest)

Example
A = {1, 2, 3, 4}
B = {12, 13}
(
B if empty(A)
join(A, B) =
attach(head(A), join(tail(A), B))

Think: How would you attatch the last element of A which is 1 to B

You might also like