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

  Find all companies located in every city

Assume the companies may be loacted in several cities. Find all companies located in every city in which small bank corporation is located. Write relational algebra query. Use  in database system concepts sixth edition for schema.

  You have been asked to develop uml diagrams to graphically

you have been asked to develop uml diagrams to graphically depict and describe the architecture of two 2 unrelated

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Network lan and the wan links

Use VLSM to configure the given network LAN and the WAN links. VLSM must be used in the MOST efficient way to subnet the LAN and the WAN links. All the links between routers are WAN links.

  What are the basic concepts of circuit switching

What are the basic concepts of circuit switching?What are the advantages and disadvantages of circuit switching?

  How a company developed a template for a web page

Marion has argued that with modern information technologies, collocation of team members is no longer important. How would you respond to this claim?

  Let l be a language over s

Please answer the question by the following format: example:Let L be a language over Σ = {0, 1}, construct a DFSA that accepts it, as well as a regex that denotes it for the following languageL = {x ∈ Σ* : x ends in 01 or 10 or 00 or 11 }.

  Examine about direct cash-payment method

Examine about Direct Cash-Payment method

  Implementation of it and it goals of organization

You will conduct an evaluation of the business goals of DynCorp International. Prepare a mapping of IT goals for DynCorp International that will support the business goals.

  Write a program segment that initializes memory locations

Write a program segment that initializes memory locations $0000 and $0001 with $12 and $10 using assembler directives.

  Computers on the internet have an assigned address

Computers on the Internet have an assigned address (location) called its Uniform Resource Locator (URL). The URL is used to identify one computer to the other computers on the Internet.

  Write a program that creates an array of structures

Write a program that creates an array of structures of type Student. The structures must include the following data members (it can have more!): a. A string to hold a first name of no more than 10 characters; b. A string to hold a middle name of no ..

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