Result of evaluating

Assignment Help Basic Computer Science
Reference no: EM13963471

Consider the following functions, written in ML:

exception Excpt of int;

fun twice(f,x) = f(f(x)) handle Excpt(x) => x;

fun pred(x) = if x = 0 then raise Excpt(x) else x-1; fun dumb(x) = raise Excpt(x);

fun smart(x) = 1 + pred(x) handle Excpt(x) => 1;

What is the result of evaluating each of the following expressions?

(a) twice(pred,1);

(b) twice(dumb,1);

(c) twice(smart,0);

In each case, be sure to describe which exception gets raised and where.

Reference no: EM13963471

Questions Cloud

Spectrophotometric data for kmno4 : 1. Scenario: You are in in the lab and just created the graph for Data Table 1. After looking at the data, for which concentration of solution would you repeat the absorbance measurement if enough time was left in lab? Why?
How gains or losses on impaired assets : Explain how gains or losses on impaired assets should be reported in income in IFRS.
Write a program that prompt the user to enter the two points : Write a program that prompts the user to enter the two points, and then displays the distance between them. You may assume the values entered are valid.
Mickley company''s predetermined overhead rate : Mickley Company's predetermined overhead rate is $23.00 per direct labor-hour and its direct labor wage rate is $15.00 per hour. The following information pertains to Job
Result of evaluating : Consider the following functions, written in ML: exception Excpt of int; fun twice(f,x) = f(f(x)) handle Excpt(x) => x;
Which has the greater wavelength, blue light or red light : A photon corresponding to a particular frequency of blue light produces a transition from the n = 2 to the n = 5 level of a hydrogen atom. Could this photon produce the same transition (n = 2 to n = 5) in an atom of X? Explain.
Explain the implications of research on parental behavior : In your initial post of a minimum of 350 words, explain the implications of the research on parental behavior and environmental factors as they relate to human personality development. Describe how this research data might be used to explain unhea..
Teledex company manufactures products to customers : Teledex Company manufactures products to customers' specifications and operates a job order costing system. Manufacturing overhead cost is applied to jobs on the basis of direct labor cost
Algol 60 procedure types : In Algol 60, the type of each formal parameter of a procedure must be given. How- ever, proc is considered a type (the type of procedures).

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Explain how determine the process state and what are states

Explain how to determine the process state and what are the states a process can be in. (Hint: use the man pages! You may have to do some cross referencing

  Explain how they might be avoided

when is compaction of secondary storage beneficial from the file managers perspective? give several examples. list some problems that could be presented as a result of compaction and explain how they might be avoided.

  Identify major points to include in communications plan

Identify the major points you would include in a communications plan at this point in the project? what advice would you give your project team to help it manage the user expectations?

  Describe the purpose and activities

Describe the purpose and activities

  Naming rules for creating variables

6. Explain the naming rules for creating variables, and then provide three examples using the data types int, double, and char and assign values to them. 7. What is the advantage of using the conditional operator?

  Differentiate between classification of data and clustering

Give two examples, apart from those given in the slides, for each of the following: a) Data mining from the commercial viewpoint b) Data mining from the scientific viewpoint. Differentiate between classification of data and clustering of data with th..

  The complete procedure for enabling windows

The complete procedure for enabling Windows Remote Management and executing a command that uses the adatumAdministrator account to create a local user account for a user called Mark

  Why you think that the cio is this type of manager

Using the IT Savvy four types of the CIO (page 146 IT Savvy below), choose a type for each of CIO or IT leaders for the following 8 cases attached (Attachments 1-8).Give example of why you think that the CIO is this type of manager.

  Unique ids of network adapters

Network adaptors are manufactured by many companies in many countries. How can these companies ensure no two adaptors will have the same MAC address?

  Determine and print the average age of your family

Design a program that will allow a user to Input a list of your family members along with their age and state where they reside. Determine and print the average age of your family and print the names of anyone who lives in Oregon.

  Assume the friction coefficient between the rope and capstan

How many wraps around the capstan are required such that one person exerting 100lbs of force can keep the ship at its mooring. Assume the friction coefficient between the rope and capstan is 0.2.

  Address-based authentication works

Explain how address-based authentication works. Is this a secure authentication technique? Why or why not?

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