
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Instructions for a homework assignment in a computer science course (cs 421) where students are required to fill in missing environments in an execution sequence of a let expression. The document also includes the evaluation rules and the class notes and supplementary notes for reference.
Typology: Assignments
1 / 1
This page cannot be seen from the preview
Don't miss anything!

Please print these two pages, fill in the answers, and hand in the homework in class.
The evaluation rules are given in the class notes and supplementary notes for March 25. In the following execution sequence, fill in the missing environments. You should use the linked version of environments, as was done in the second part of the class notes and in the supplementary notes. In some cases, we’ve given names to the environments; in subsequent execution steps, you can refer to those environments by name instead of writing the entire environment.
The execution sequence is given for the following top-level definition and expression:
let h x = let g b= x+b in let c = g x in g c;; h 4;;
Execution starts in environment ρ.
b) Proceed with env. ρ1 = { h → <x, let g b = ... in g c, ρ>, • } ρ
c) Evaluate let g b = ... in g c in ρ2 = { x → 4, • } ρ (let rule) i) fun b -> x+b, ρ 2 ⇓ <b, x+b, ρ2> (function rule)
ii) Evaluate let c = g x in g c in ρ3 = { g → <b, x+b, ρ2> , • } ρ 2 (let rule)
CS 421, hwk 9 , written part. Due April 3. Name _________________________________________