9 Pages

lexical-address-hints

Course: CS 342, Fall 2009
School: Iowa State
Rating:
 
 
 
 
 

Word Count: 708

Document Preview

This ;;; file has three parts: ;;; ;;; 1. a set of hints for writing lexical-address, ;;; 2. a (very spartan) structure of the code that you can fill in, ;;; 3. a set of examples that try to explain the structure. ;;; ;;; HINTS FOR writing the procedure lexical-address: ;;; ;;; 1. You must use the helpers in lambda-if-exp.scm to pick apart ;;; the input <expression>s, and then you must use the...

Register Now

Unformatted Document Excerpt

Coursehero >> Iowa >> Iowa State >> CS 342

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
This ;;; file has three parts: ;;; ;;; 1. a set of hints for writing lexical-address, ;;; 2. a (very spartan) structure of the code that you can fill in, ;;; 3. a set of examples that try to explain the structure. ;;; ;;; HINTS FOR writing the procedure lexical-address: ;;; ;;; 1. You must use the helpers in lambda-if-exp.scm to pick apart ;;; the input <expression>s, and then you must use the helpers in ;;; lexical-addr-exp-mod.scm to put them back together into ;;; <lexical-addr-exp>s. ;;; ;;; 2. Follow the (input) grammar for an outline of your code for each ;;; procedure!! ;;; ;;; 3. Because the globally bound (free) variables may have an ;;; arbitrary position number, our test cases do not automatically ;;; check the result when there is more than one free variable in the ;;; expression. Hence, it will be up to *you* to make sure that the ;;; free variables have unique position numbers. Check the output of ;;; these tests by hand to be sure. ;;; ;;; 4. Test your procedures from the bottom up; i.e., test the ;;; procedures that are called by other procedures first. Use the ;;; expected results of helpers when testing procedures that call the ;;; helpers. ;;; ;;; 5. The easiest approach to writing the lexical-address procedure ;;; is to write at least two helping procedures. (Because of tail ;;; recursion you may need more!) In our design, shown schematically ;;; below, there are two helping procedures, which are described below ;;; the structure, with examples following it. ;;; Structure [omitted] ;;; Notes on lexical-address-helper: ;;; ;;; The procedure lexical-address-helper takes a parsed lambda-if-exp, ;;; exp, and a list of lists of symbols, var-table. In var-table, ;;; each of the sublists corresponds to a the variables declared in a ;;; region (i.e., globally or by a lambda). Look at the examples ;;; (below) for how lambda is handled. The last sublist in var-table ;;; always contains the free variables found in the expression. The ;;; next-to-last sublist, if any, always contains the list of ;;; variables declared in the outermost lambda surrounding the ;;; expression, and so on until one reaches the first sublist, which ;;; contains the list of variables declared in the closest surrounding ;;; lambda surrounding the expression. ;;; ;;; To obtain the starting value to pass to the initial call to ;;; lexical-address-helper, you will likely want to use free-vars for ;;; the lambda-if-exp grammar as a helper. This allows the position ;;; in the last sublist of var-table to be used as the unique position ;;; number for the lexical address of each free variable. ;;; Some examples: ;;; ;;; (lexical-address-helper (parse-expression 'x) ;;; '((p q r x y) (w z x) (car ls)) ) ;;; ==> (x : 0 3) ;;; (lexical-address-helper (parse-expression 'x) ;;; b) '((a (p q r) (x y) (car ls)) ) ;;; ==> (x : 2 0) ;;; (lexical-address-helper (parse-expression '(quote x)) ;;; '((a b) (p q r) (x y) (car ls)) ) ;;; ==> (quote x) ;;; (lexical-address-helper (parse-expression '(car ls)) ;;; '((car ls)) ) ;;; ==> ((car : 0 0) (ls : 0 1)) ;;; (lexical-address-helper (parse-expression '(car ls)) ;;; '((ls car)) ) ;;; ==> ((car : 0 1) (ls : 0 0)) ;;; ;;; The next sequence of examples traces what should happen with recursive ;;; calls on lambda expressions. Notice the way the list of variable lists ;;; (the second argument) changes with each recursive call below. ;;; ;;; ; Example 1: ;;; (lexical-address-helper (parse-expression ;;; '(lambda (q r p) ;;; (lambda (x y) (if (p u) (h x) (t y))))) ;;; '((h t u)) ) ; second argument with free vars ;;; ; Note: the list of free variables is ;;; ; a member of the list of variable lists ;;; ==> (lambda (q r p) ;;; (lambda (x y) ;;; (if ((p : 1 2) (u : 2 2)) ;;; ((h : 2 0) (x : 0 0)) ;;; ((t : 2 1) (y : 0 1))))) ;;; ;;; ; Example 2: ;;; (lexical-address-helper (parse-expression ;;; '(lambda (x y) (if (p u) (h x) (t y)))) ;;; '((q r p) (h t u)) ) ; second argument ;;; ==> (lambda (x y) ;;; (if ((p : 1 2) (u : 2...

Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Iowa State - CS - 342
I. static properties of variables (EOPL2e 1.3) A. static vs. dynamic properties- STATIC VS. DYNAMIC PROPERTIES (1.3)def: a property of a language is: - *static* if - *dynamic* ifStatic properties are important for-Are the
Duke - CPS - 102
Compsci 102 Extra Credit HWFall 2008Instructions: Questions may continue on the back. Please write clearly. What I cannot read, I will not grade. Typed homework is preferable. A good compromise is to type the words and write the math by hand. Sho
Duke - CPS - 234
1 Problem 1Reference: Computing common tangents without a separating line by David Kirkpatrick and Jack Snoeyink. (http:/www.springerlink.com/content/730l2v3604577424/)2 Problem 2Reference: Algorithms for bichromatic line-segment problems and pol
Duke - CPS - 081204
CompSci 4 Java 5 J Dec 4, 2008Prof. Susan RodgerAnnouncements Be a UTA for CompSci 4 sign up 4 Next semester with Alice 3.0 with the Sims Paid ($) great learning experience! ($), Evaluations Fi l project presentations Sat Dec 13 Final j t
Duke - CPS - 081125
CompSci 4 Java 3 J Nov 25, 2008Announcements Assignment 7 Storyboard due today Assignment and web p g due next Tuesday g page y Assignment 7 presentation on Dec 13! Attendance required! Sec 1: 9-noon, Sec 2: 7-10pmProf. Susan Rodger Last J
Purdue - LECT - 221
Requirements for a system to obey Beer's Law: 1. Incident radiation is monochromatic 2. Molecules act independently of one another regardless of concentration (each molecule independently absorbs light) 3. Absorption is limited to a volume of uniform
Maple Springs - NATS - 1740
Chapter 16 Dark Matter, Dark Energy, &amp; The Fate of the UniverseWhat do we mean by dark matter and dark energy?16.1 Unseen Influences in the CosmosDark Matter: An undetected form of mass that emits little or no light but whose existence we infer
Duke - CPS - 234
A SSIGNMENT 4 Due Date: December 4, 2008C OURSE : CPS234Problem 1: [10pts] Let S be a set of n segments in R2 . Describe a randomized algorithm to count the number of intersection points in S whose expected running time is O(n4/3 log n). Problem
Duke - MC - 182
Michael Connolly Extra Credit-CodeIn Lawrence Lessig's Code, the overall argument is that the nature of cyberspace is merely a reflection of its code. This code defines this space of the Internet, but it is readily subject to change. Lessig delinea
Clark University - SOC - 275
Capstone Research Paper Family Issues in an Aging Society (SOC 275) Spring 2002 Your research paper can be either a) a review of current literature in the area or b) your own original research. The paper should be between 25 and 30 pages. I would lik
Virginia Tech - USA - 1921
Wagenknecht to UCP DOs [Feb. 1, 1921]1Circular Letter to All District Organizers of the United Communist Party of America From Executive Secretary Alfred Wagenknecht,February 1, 1921.DoJ/FBI Investigative Files, NARA M-1085, reel 939, doc. 54.
Virginia Tech - USA - 1921
Dirba &amp; Ballam: Letters to Tyverovsky [Sept. 1921]1Letters to Oscar Tyverovsky in Moscow from Charles Dirba (Sept. 3, 1921) and John Ballam (Sept. 2, 1921).A document in the Comintern Archive, f. 515, op. 1, d. 39, ll. 104-105.I - Dirba to Tyv
Virginia Tech - PUBS - 442
publication 442-758Brian Benham, Assistant Professor and Extension Specialist, Department of Biological Systems Engineering, Virginia TechA Glossary of Water-Related TermsThe definitions and associated explanations of water-related terms presen
Virginia Tech - PUBS - 442
publication 442-550TMDLs (Total Maximum Daily Loads) Terms and DefinitionsBrian Benham, Assistant Professor and Extension Specialist, Virginia Tech Kevin Brannan, Research Associate, Virginia Tech Theo Dillaha, Professor, Virginia Tech Saied Most
Virginia Tech - PUBS - 426
publication 426-615The Virginia Gardener Guide to Pest Management forWater QualityDiane Relf, Extension Specialist, Horticulture, Virginia Techwww.ext.vt.eduProduced by Communications and Marketing, College of Agriculture and Life Sciences, Vir
Virginia Tech - PUBS - 456
Home Vegetables: Insects 2-7Eric R. Day, Extension Entomologist, Virginia TechInsectsTable 2.5 - InsecticidesCrop Asparagus Insect Asparagus beetle, Grasshopper Aphid Treatment and Amount to Mix with 1 Gallon of Water or Remarks and Days Betwe
Virginia Tech - PUBS - 354
publication 354-096Families Taking ChargeSources of Friendship and SupportIntroductionPeople experiencing unemployment report they feel better if they have the support of family and friends. Your informal support networks are the personal ties
Clark University - MGMT - 250
MGMT250 NotesFebruary 26, 2003Schedule a. Begin Location Analysis - Quick Background discussion b. Location Analysis Begin Factor Attribute Ratings and maybe Transportation Tableau. c. Next Class is off (spring-break). d. Midterm Exam on Wednesd
Duke - CPS - 004
CompSci 4 Exam 1Example QuestionsPossible5 5 5Name: _TopicErrors of Omission Changing Levels Adding an Extra LifeEarnedCompSci 4Page 1 of 4Errors of Omission (5 points)1.Explain why removing the following line from the Asteroids cla
St. Leo - ACC - 302
EXERCISES1121. (a) Cash. Common Stock. Paid-In Capital in Excess of Par. Issued 20,000 shares of $2 par common stock at $30. Organization Expense. Common Stock. Paid-ln Capital in Excess of Par. Issued 250 shares of $2 par common stock in return for
Duke - CPS - 090409
CompSci 4 Java 3 J Apr 9, 2009Prof. Susan RodgerAnnouncements Assignment 7 Must have Storyboard! Assignment and web page due tonight g p g g Assignment 7 presentation on Apr 16 and 21. Attendance required! Extra Office Hours today, Rodger:
Clark University - SOC - 275
Distant Parents- Ch. 1, 2, and 4 Discussion Guidelines 1. The aging revolution has lengthened the parent-child relationship by significantly increasing the human life span. What changes might this pose for various family members as well as challenges
Purdue - MA - 266
Clark University - MA - 121
Math 121, Calculus II Clark University Final Exam Answers, Spring 20091. [12] Suppose a point moves along the x-axis with acceleration a(t) = 1 (e3t - e-3t ) 2 meters per second squared. If the point starts at the origin with velocity 30 meters per
Portland - CS - 200
Topic: GNU GDB Basic CommandsSeveral basic commands- Start the program (run or r) - Set/remove breakpoints (b, del) - Display source code with list (list or l) - Step the program statement (step or s) - Continue (continue or c) - Print variable val
Portland - CS - 200
Topic: Program Encoding and Data FormatsOutline- Brief review of evolution of computer architecture - What does object code look like? Reading: B&amp;O 3.1 3.3IA32 HistoricallyWe will focus on the Intel &quot;IA32&quot; architecture Evolutionary Design- Pro
Virginia Tech - PUBS - 356
publication 356-485Janice Woodard, Retired Extension Specialist, Home Management and Equipment Blake Ross, Extension Specialist, Biological Systems EngineeringHousehold Water Testing Kathleen Parrott, Extension Specialist, HousingHousehold Wate
Portland - CS - 105
Chapter 2The Internet, The Web, and Electronic CommerceMcGraw-Hill/IrwinCopyright 2008 by The McGraw-Hill Companies, Inc. All rights reserved.Competencies (1 of 2) Discuss the origins of the Internet and the Web Describe how to access the W
Portland - CS - 145
FunctionsFunctionsWestern Washington University1Subprograms A program within a program A module code written to define one well-defined subtask Benefits of modularity Easier to test, debug, and correct bottom up testing - independent t
Virginia Tech - PUBS - 442
introductionRobert Bobby Grisso, Extension Engineer, Biological Systems Engineering, Virginia Tech John Perumpral, Emeritus Professor, Biological Systems Engineering, Virginia Tech S. Christian Mariger, Instructor, Biological Systems Engineering, V
Maryland - PHYS - 122
Arkansas Monticello - PSY - 1013
Study Guide for Exam#4*Note: The exam really will cover material from the book that was not covered in lecture, as well as the material covered in lecture. Make sure you have studied material from both sources.Chapter 10 Personality Key people: S
Portland - SBA - 306
Portland - SBA - 448
COMPARISON OF ECONOMIC AND LIVING ORGANIZATIONS ECONOMIC ORGANIZATION Focused on the internal goal of the organization Changes when it meets the organization's internal needs Acts on pain of crisis Responds to and with organizational memory Learns by
Portland - SBA - 306
Chapter 6 Questions 1. The major objective of financial statement analysis is _ _. 2. Two additional objectives of financial statement analysis are _ _ and _. 3. The two most important uses of ratios are for _ _ and _. 4. _ ratios measure the past ea
Portland - SBA - 211
BA 211 Chapter 14 Quiz (Theory onlyno homework problems assigned) 1. Determining how to price a company's products is a(n) a. financing decision b. investing decision c. operating decision d. financial reporting decision Companies will usually compet
Virginia Tech - PUBS - 310
Question and Answer Guide forStarting and Growing Your Small BusinessQuestion and Answer Guide for Starting and Growing Your Small BusinessTABLE OF CONTENTSAcknowledgements . . . . . . . . . . . . . . . . . . . . . . .
Virginia Tech - PUBS - 430
REPRINTED 2004Trees for Problem Landscape SitesPUBLICATION 430-024Bonnie Appleton and Eva Lynn Trump Rudiger* Roger Harris, Kathy Sevebeck, Dawn Alleman, Lynnette Swanson*Trees for Hot SitesHot landscape sites require special consideration b
Purdue - MA - 154
Math 154Name:Quiz # 61. (5 pts.) Kate is in another section of Math 154. Due to the flu, she has missed the last week of class. Right now, Kate has trouble understanding periodic function. Write a short letter (using complete sentences of course
Virginia Tech - USA - 1919
NY Call: Chicago Police Invade Communist Convention Hall [Sept. 1, 1919]1Chicago Police Invade Hall of Communists:Red Decorations Torn Down - Lawyer Beaten Unconscious - New Party Formed.Published in the New York Call, v. 12, no. 245 (Sept. 2,
Oregon State - CS - 361
VISION &amp; SCOPEEnter Project Name (Process Title)Date Prepared: Project Team: Desired Project Completion Date: [Directions for using template: Read the guidance, (blue text), to understand the information that should be placed in each section of th
Oregon State - EXAM - 735
Drug MetabolismA Chemistry Perspectivephil.proteau@oregonstate.eduPHAR 735 Dr. Phil Proteau Rm. 127 Office hours 12:00-1:00 pm M-F or whenever my door is open I. Importance of Drug Metabolism A. Biodistribution of DrugsThe general tendency is
Oregon State - CS - 331
a new voyage will fill your life with untold memoriesyou are on the verge of something biga pleasant experience is ahead don't pass it bya thrilling time is in your immediate futurea heavy burden is lifted with a phone message or letteryou are g
Virginia Tech - MATH - 1535
Math 1535Homework 1 Due: Wednesday, August 30/Tuesday, August 29 Name:Online Portion: Complete Online Assessment 1. You may attempt this assessment as many times as you wish, but the deadline is 5:00 pm Wednesday, August 30. The purpose of this
Purdue - ENGL - 106
Japan, like many Asian nations, had a turbulent history. It was a victim of Western imperialism and, like many of those around it, was forced to accept numerous unequal agreements with the West. This, however, was where the similarities end. Japan ma
Portland - CS - 350
CS 350 Algorithms and Complexity HOMEWORK #3 Due On: August 5th, 2003 Read Chapter 8 (assigned sections) and 23, 24 and 25(assigned sections) of Introduction to Algorithms by T. Cormen, C. Leiserson and R. Rivest. Try to be as clear as possible in yo
Maryland - ISR - 200312
NEXTOR CDM REVIEW UNIVERSITY OF MARYLAND SEPTEMBER 25, 2003Faculty participants: Michael Ball, Dave Lovell, U of Maryland J.P. Clarke, MIT; Mark Hansen, UC Berkeley Hanif Sherali, Toni Trani, VPISU Other senior researchers: Jim Evans, Lincoln Labs;
Portland - MTH - 253
CALCULUS III FALL 2002 IN-CLASS ASSIGNMENT EExercises SIMPLIFY ALL ANSWERS. Unless the contrary is stated GIVE EXACT ANSWERS-NOT DECIMAL APPROXIMATIONS. (1) The series (-1)k converges . By computing the k ln k 2 partial sums S6 and S7 we know that
Portland - MTH - 253
CALCULUS III FALL 2002 IN-CLASS ASSIGNMENT DExercises SIMPLIFY ALL ANSWERS. Unless the contrary is stated GIVE EXACT ANSWERS-NOT DECIMAL APPROXIMATIONS. (1) Let n 2 and f be a continuous, positive, decreasing function defined on the interval [1, n
Portland - MTH - 253
CALCULUS III FALL 2002 IN-CLASS ASSIGNMENT JExercises SIMPLIFY ALL ANSWERS. Unless the contrary is stated GIVE EXACT ANSWERS NOT DECIMAL APPROXIMATIONS. (1) The points whose polar coordinates satisfy the equation 1 r csc 1 = 2 cot lie 2 on a cir
Portland - MTH - 253
CALCULUS III FALL 2002 IN-CLASS ASSIGNMENT GExercises SIMPLIFY ALL ANSWERS. Unless the contrary is stated GIVE EXACT ANSWERS NOT DECIMAL APPROXIMATIONS. (1) The coecient of the term containing x12 in the power series expansion of a (1 + x3 )3/5 is
Oregon State - EXAM - 735
Theresa Filtz, PhD Phar 735, Winter 2006G protein-coupled Signal TransductionMain Objectives (the big chunks) Describe in molecular detail the cascades of events in a generalized G protein-coupled signaling pathway Describe the structure of a GP
Portland - MTH - 253
CALCULUS III FALL 2002 IN-CLASS ASSIGNMENT FExercises SIMPLIFY ALL ANSWERS. Unless the contrary is stated GIVE EXACT ANSWERS-NOT DECIMAL APPROXIMATIONS. (1) Find the Maclaurin polynomial of degree 4 for the function f (x) = (x + 1)3/2 + (x + 1)1/2
Portland - MTH - 253
CALCULUS III FALL 2002 IN-CLASS ASSIGNMENT CExercises SIMPLIFY ALL ANSWERS. Unless the contrary is stated GIVE EXACT ANSWERS-NOT DECIMAL APPROXIMATIONS.(1) The series k . (2) Let Sn = a= 1 n k=0ln k diverges because ak ln(3 + k 2 ) 1 2k+4
Portland - MTH - 253
CALCULUS III FALL 2002 IN-CLASS ASSIGNMENT HExercises SIMPLIFY ALL ANSWERS. Unless the contrary is stated GIVE EXACT ANSWERS NOT DECIMAL APPROXIMATIONS. (1) Use series to solve the dierential equation f (x) = f (x) subject to the initial condition
Virginia Tech - PUBS - 430
publication 430-399Nutrient Management for Golf CoursesJames H. May, Research Associate, Crop and Soil Environmental Sciences John R. Hall, Professor and Extension Specialist, Turfgrass Management David R. Chalmers, Associate Professor and Extensi
Portland - MTH - 253
CALCULUS III FALL 2002 ASSIGNMENT 05ExercisesDue Mon. Oct. 21SIMPLIFY ALL ANSWERS. Unless the contrary is stated GIVE EXACT ANSWERSNOT DECIMAL APPROXIMATIONS. (1) The series (1)n+1 . By computing the converges n n=1 partial sums S24 and S25 we
Portland - MTH - 253
CALCULUS III FALL 2002 IN-CLASS ASSIGNMENT I Suppose that f is a function on the interval [a, b] with derivatives of all orders and that the interval [a, b] has been partitioned into n subintervals of equal length. We use the following notation:bI
Virginia Tech - PUBS - 424
ON-FARM SOYBEAN TESTA Summary of Research and Demonstration Plots Conducted by Virginia Cooperative Extension in Cooperation with Local Producers and Agribusiness Conducted and summarized by: Wes Alexander, Extension Agent, Southampton County Keith
Portland - SBA - 516
Japanese Colonialism in KoreaNathan Hahn Julia Santos Colin Looi Damask SchantzGroup 2 April 14, 2009Agenda Background/pre-colonial history Japanese Colonial Rule Korean reactions and effects Korean self perception Business and foreign po
Portland - SBA - 459
ISQA 459/559 Problem Set 3 Due March 12, 2009(Please use Problem Set 3 template for your answers, available on website) PROBLEM 1: (MPS FOR MURPHY MOTORS) The MPS planner at Murphy Motors uses MPS time-phased records for planning enditem production