What is a declarative program? That is, what is its defining characteristic?
What is an important advantage of the linked representation of sequences over the sequential representation?
What is an important advantage of the sequential representation of sequences over the linked representation?
What is the difference between a strongly statically typed language and a weakly statically typed language?
What is the defining characteristic of a dynamically typed language?
What is the head of list [3,5,4,8]?
What is the tail of list [3,5,4,8]?
What is the head of list [4,2]?
What is the tail of list [4,2]?
What is a solution to pattern match equation [x, y+1] = [7, 99]?
What is a solution to pattern match equation x :: y :: z = [1, 2, 3, 4]?
Why did structured programming replace programming using gotos?
Given the definition
f([]) = [] f(h::t) = (h*h)::f(t) when h > 10 f(h::t) = f(t) when h <= 10show an evaluation of expression f([4, 12, 15, 6, 11]) by substitution. Show the entire expression at each step. Assume that arithmetic is done as soon as possible.
Write an equational definition of a function prefix so that prefix(x, y) is true just when list x is a prefix of list y. For example, prefix([1, 2], [1, 2, 4, 6]) is true, but prefix([1, 2], [1, 5, 2, 6]) is false. It is not required that x be a proper prefix of y. So prefix([2, 3], [2, 3]) is true. The empty list is a prefix of every list.
Show an inside-out evaluation of prefix([1, 2], [1, 2, 3, 4]) using your definition of prefix from the preceding question. Show the entire expression at each step.
Write an equational definition of longestCommonPrefix(x, y), which yields the longest list that is a prefix of both x and y. For example, longestCommonPrefix([2, 5, 3, 9, 5], [2, 5, 2, 9, 5]) = [2, 5].
Show an inside-out evaluation by substitution of longestCommonPrefix([2, 5, 3, 9, 5], [2, 5, 2, 9, 5]). Show the entire expression at each step.