Given this function:
Fill in the blank so that list-len correctly calculates the length of lst.
rest
In order to calculate the length of lst, we add 1 to the length of the rest of lst.
Given this function:
Fill in the blank so that list-sum correctly computes the product of all the value in lst.
first
To get the product of all the values in lst we multiply first by the product of the rest of lst.
Is
a valid list?
( ) Yes
( ) No
( ) Yes
(X) No
No–the second argument of link needs to be of type List.
Given this code:
Fill in the blanks such that is-member correctly returns true if item is a member of lst, and false if otherwise.
Blank1: ____
Blank2: ____
Blank3: ____
Blank4: ____
Blank1: false
Blank2: item
Blank3: rest
Blank4: item
If lst is empty, then the function has finished going though the entire list and returns false. Otherwise, the functions checks if first is equal to item. If it is, the function returns true, otherwise it makes a recursive call on the rest of the list.