Problem regarding the order of evaluation

Assignment Help Basic Computer Science
Reference no: EM13963462

Order of Evaluation

In pure lambda calculus, the order of evaluation of subexpressions does not effect the value of an expression. The same is true for pure Lisp: if a pure Lisp expres- sion has a value under the ordinary Lisp interpreter, then changing the order of evaluation of subterms cannot produce a different value.

To give aconcrete example, consider the following section of Lisp code:

(define a ( ... ))

(define b ( ... ))... (define f (lambda (x y z) (cons (car x) (cons (car y) (cdr z))))) ... (f e1 e2 e3)

The ordinary evaluation order for the function call (f e1 e2 e3) is to evaluate the arguments e1 e2 e3 from left to right and then pass this list of values to the function f.

Give an example of Lisp expressions e1 e2 e3, possibly by using functions rplaca or rplacd with side effects, so that evaluating expressions from left to right gives a different result from that obtained by evaluating them from right to left. You may ?ll in speci?c declarations for a or b if you like and refer to a or b in your expressions. Explain brie?y, in one or two sentences, why one order of evaluation is different from the other.

Reference no: EM13963462

Questions Cloud

What mass of helium will be required. : A 1-liter container of nitrogen gas (N2) at a temperature of 23c is intially at a pressure of 1.25 atm. because of a slow leak the pressure falls to 1.15 atm 1 hour later what is the leak rate in molecules/second?
Overview of the symbolic interactionist perspective : Provide an overview of the "symbolic interactionist" perspective in sociology - what are its main ideas, how does it differ from other sociological approaches
Denotational semantics : The text describes a denotational semantics for the simple imperative language given by the grammar
Calculate the entropy change for each of the following : 10g of steam at l00°C and a pressure of one atmosphere condensing into water at the same temperature and pressure. (The latent heat of vaporization of water is 22571 Jg^-1).
Problem regarding the order of evaluation : In pure lambda calculus, the order of evaluation of subexpressions does not effect the value of an expression. The same is true for pure Lisp: if a pure Lisp expres- sion has a value under the ordinary Lisp interpreter, then changing the order of ..
What are your thoughts about the aim : What are your thoughts about the aim, results, and implications of the study in terms of the author's efforts to understanding and assessing the identified domains of sexual values highlighted in the study
How many photons are incident on surface breast tissue : The entrance exposure during a mammography examination is 100mR. Suppose the photon bean consists of photons each of energy 20 keV. How many photons are incident on a 1 cm^2 surface of breast tissue?
What is the average molar specific heat in this range : The molar specific heat of many materials at low temperatures is found to obey the Debye law C_v = A[T/theta]^3 where A is a constant equal to 1.94 x 10^3 Jmol^-1K^-1 and with the Debye temperature theta taking different values for different mater..
Selling an old a car : John called you late on Friday afternoon with a simple question. He is considering selling an old a car and wants to know what the tax implications will be.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Supplier and the number of products they supply

Show the name of each supplier and the number of products they supply. Order by supplier name.Show the name of each category and the number of products in each category. Only show categories that have more than three products. Order by category ..

  User enters a negative number or a nondigit number

If the user enters a negative number or a nondigit number, throw and handle an appropriate exception and prompt the user to enter another nonnegative number.

  Your manager has decided that the throughput

Your manager has decided that the throughput of your file server can be improved by replacing your old SCSI-2 host adapter with a "fast and wide" SCSI-3 adapter. It has also been decided that the old SCSI-2 drives will be replaced with "fast and w..

  Write a program that will read in a file of student academic

Write a program that will read in a file of student academic credit data and create a list of students on academic warning. The list of students on warning will be written to a file. Each line of the input file will contain the student name

  Write a procedure homming

Submit your programs by email. The program should have as many comments as necessary. The top comments should explain how to run and test the program. If any two assignments have the same code, zero marks will be assigned to the assignments.

  Examine the specifications for an enterprise class firewall

Examine the specifications for an enterprise class firewall and a personal or home firewall. Determine why all firewalls are not equal. Assess the effectiveness of each and determine if one outperforms another at its intended function.

  Creating an oracle

The clique problem itself is NP-hard. Thus you may not wish to have an oracle that runs in exponential time. Consider approach to approximate the solution.

  Which access database object asks a question about data

Which Access database object asks a question about the data stored in a database and displays specific fields and records that answer the question?

  Premiere products exercises: relational algebra

In the following exercises, you will use the data in the Premiere Products database. In each step, indicate how to use relational algebra to obtain the desired results.

  Write a program that contains a main function

Write a program that contains a main function and three other functions that will return various attribute information about an array of floating point numbers:

  What is the response time for jobs in observed system

We observe a closed system for 30 minutes, during which 1600 tasks are completed, from 12 terminals. Each terminal (source of tasks). What is the response time for jobs in the observed system?

  Show by induction

Show by induction that n^5- n is divisible by 5 for all n ? 0.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd