Docsity

CS 3721 Lab: Lambda Calculus Exercises, Lab Reports of Programming Languages

Toggle sidebar
bg1
CS 3721: Programming Languages Lab
Lab #03: Lambda Calculus
The purpose of this recitation is to practice the reduction of lambda terms and the trans-
lation from Lambda Calculus to Scheme. For each of the given lambda terms, answer the
following questions.
1. Is the given lambda expression in normal form? If not, reduce it to normal form.
You can write down your reduction steps on a piece of paper (remember to submit
before you leave) or save your reduction steps in the Dr.Scheme definition windown
as embedded coments.
2. Translate the given lambda term to Scheme expressions in the definition window. Run
the Scheme expression. The result of evaluation should be identical to that of your
manual reduction in step(1).
After you are done, save your solution to a scheme file and submit it online at
www.cs.utsa.edu/~cs3723
1. λx . λy . λz . x y z
2. (λx . λy . λz . x y z) (λx . x)
3. (λx . λy . λz . x y z) (λx . x) (λy. y+1)
4. (λx . λy . λz . x y z) (λx . x) (λy. y+1) 3
5. λy. (λx . λy . λz . x y z) (λx . y x) (λy. y+1) 3
1

Partial preview of the text

Download CS 3721 Lab: Lambda Calculus Exercises and more Lab Reports Programming Languages in PDF only on Docsity!

CS 3721: Programming Languages Lab Lab #03: Lambda Calculus

The purpose of this recitation is to practice the reduction of lambda terms and the trans- lation from Lambda Calculus to Scheme. For each of the given lambda terms, answer the following questions.

  1. Is the given lambda expression in normal form? If not, reduce it to normal form. You can write down your reduction steps on a piece of paper (remember to submit before you leave) or save your reduction steps in the Dr.Scheme definition windown as embedded coments.
  2. Translate the given lambda term to Scheme expressions in the definition window. Run the Scheme expression. The result of evaluation should be identical to that of your manual reduction in step(1).

After you are done, save your solution to a scheme file and submit it online at

www.cs.utsa.edu/~cs

  1. λ x. λ y. λ z. x y z
  2. (λ x. λ y. λ z. x y z) (λ x. x)
  3. (λ x. λ y. λ z. x y z) (λ x. x) (λ y. y+1)
  4. (λ x. λ y. λ z. x y z) (λ x. x) (λ y. y+1) 3
  5. λ y. (λ x. λ y. λ z. x y z) (λ x. y x) (λ y. y+1) 3