The mathematical model of computation that

Info icon This preview shows pages 2–3. Sign up to view the full content.

1. The mathematical model of computation that denotational semantics is based upon is called . 2. A(n) is a condition which is true upon entry to a loop every time the loop is entered, and is still true at the termination of the loop. 3. True or False. Denotational semantics is a method for defining the semantics of a programming language by giving an interpreter for that language. 4. Consider the following Lisp function: (defun update (store V n) (prog (currentenv newbinding newstore) (setq currentenv (cdaddr store))) (setq newbinding (cons (list ’eq ’V (list ’quote V)) (list n))) (setq newstore (list ’lambda (list ’V) (cons ’cond (cons newbinding currentenv)))) (return newstore)))) Note that the (prog (list of local variables) (exp-1) (exp-2) ... (exp-n) (return exp)) construction declares a list of local variables used in the expressions with exp being the value returned. Let S represent the Lisp expression (lambda (V) (cond ((eq V (quote x)) 4) (t (quote bottom)))) . What is the internal list representation that Lisp uses for S? What is (cdaddr S) ? Trace the execution of (update S ’x 5) , showing the values of currentenv , newbinding , and newstore . 5. Consider the Prolog program which solves the Towers of Hanoi problem. This problem is to move a stack of blocks from one location to another without ever changing the order in which blocks are placed on top of each other. A third stack may be used but only one block may be moved at a time. hanoi(N) :- move(N, left, center, right). move(0, X, Y, Z).
Image of page 2

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern