Lab Quiz Solutions, Foundations of Computing, Week 4 (Thursday) -- Oct 19, 2000

Name:


  1. For each expression, write down its type. Give the most specific type you can: for the expression 8, number is a better answer than word.

    1. x -- Symbol, atom or word

    2. (x) -- List

    3. '(x y z) -- List

    4. 8 -- Number or integer (symbol etc. are less specific)

    5. + -- Procedure (symbol etc. are less specific)

    6. (+ 9 10) -- List

    7. (lambda (x) (word 'super- x)) -- List

  2. For each procedure, write down the types of its arguments and its result. Give the most specific types you can.

    1. + -- Arguments: number, Result: number

    2. word -- Arguments: word, Result: word

    3. sentence -- Arguments: word or sentence, Result: sentence

    4. every -- Argument 1: procedure, Argument 2: List, Result: List

  3. For each expression, write down whether it can be evaluated or not (do not write down the value).

    1. (+ 1 2) -- Yes

    2. (+ 1 'two) -- No, second argument is not a number, it's just a symbol

    3. (+ 1 (2)) -- No, second argument is not a number, it's a list

    4. (word 1 2) -- Yes

    5. (word 'super 'stitious) -- Yes

    6. (word '(super stitious)) -- No, argument is not a word, it's a list

    7. (every 'super '(duper sonic)) -- No, first argument is not a procedcure

    8. (every (lambda (x) (word 'super- x)) '(duper sonic)) -- Yes

    9. (every '(lambda (x) (word 'super- x)) '(duper sonic)) -- No, first argument is not a procedure, it's just a list