DOC PREVIEW
UMD CMSC 330 - Quiz #4

This preview shows page 1 out of 2 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CMSC330 Spring 2011 Quiz #4 Name Discussion Time (circle one): 9am 10am 11am 12pm 1pm 2pm Instructions • Do not start this test until you are told to do so! • You have 15 minutes for this quiz. • This is a closed book test. No notes or other aids are allowed. • For partial credit, show all of your work and clearly indicate your answers. • Write neatly. Credit cannot be given for illegible answers. 1. (6 pts) Beta-reduction Write down what each of the following reduces to via a single beta-reduction step. a. (λx. (x x)) (λx. (x x)) RESULT = b. (λf.λx. (f x)) (λy. x) RESULT = c. (λx.λy. x) 0 1 RESULT = 2. (5 pts) Arithmetic Suppose you are given a lambda expression pred that computes the predecessor of a Church numeral n. That is: !"#$!! = !0 !"!! = 0! − 1 !"ℎ!"#$%! Using pred and other operators in class, give a function that, given Church numerals M and N, computes the Church numeral representation of M – N, where the result is 0 if N > M. Your function should have the following form: λM.λN. E for some E. Recall that Church numeral N has form λf.λx. f (f … (f x)), where f is applied N times to x.3. (4 pts) Free variables For each of the following expressions, write “yes” if variable x has at least one free (i.e. unbound) occurrence within the term and “no” if it does not. a. λx. x ANSWER = b. x (λx. x) ANSWER = c. λf. (λx. f (x x)) (λx. f (x x)) ANSWER = d. (λx.y) (λy. x) ANSWER


View Full Document

UMD CMSC 330 - Quiz #4

Documents in this Course
Exam #1

Exam #1

6 pages

Quiz #1

Quiz #1

2 pages

Midterm 2

Midterm 2

12 pages

Exam #2

Exam #2

7 pages

Ocaml

Ocaml

7 pages

Parsing

Parsing

38 pages

Threads

Threads

12 pages

Ruby

Ruby

7 pages

Quiz #3

Quiz #3

2 pages

Threads

Threads

7 pages

Exam #2

Exam #2

6 pages

Exam #1

Exam #1

6 pages

Threads

Threads

34 pages

Quiz #4

Quiz #4

2 pages

Threads

Threads

26 pages

Exam #2

Exam #2

9 pages

Exam #2

Exam #2

6 pages

Load more
Download Quiz #4
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Quiz #4 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Quiz #4 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?