Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

This is not Python ! It is OCAML FUNCTION PROGRAMMING LANGUAGE NEED CODE IN OCAML. Please help me this thank you!

Q1. Write a function to build a dictionary from two lists of equal length. One of the lists should contain elements that will serves as keys and the other list should contain elements that will serve as values.

Run your code to demonstrate that it works. Include the output in your answer. The output should show the two starting lists and the resulting dictionary.

What happens if the lists should chance to be of unequal length?

Q2. Now write a function that will do the inverse of the operation above i.e. this function takes a dictionary and returns two lists, one list containing keys and the other list containing values.

Can you really return two independent lists (i.e. can a function return two values)? How will you resolve this problem?

Run your code to demonstrate that it works. Include the output in your answer. The output should show the starting dictionary and the two resulting lists.

Assignment Submission Instructions

Submit your work as two files:

A .ml or .caml code file (which must execute without warnings or errors)

A Microsoft Word document containing the contents of your code file (see further instructions below

Name your files as follows: YourFirstName_YourLastName_E4 (.ml or .caml, and .doc or .doctx)

In your code file, put your name, assignment name, and the date the assignment work must be submitted, at the top.

The questions and your explanations/reasoning must be included as comments in your code listing. The comments must:

Respond to any questions asked within the primary questions given above

Explain the functioning of the code segments you have written

Provide your reasoning for why you chose to write the code the way you did and if you considered any alternate ways of writing it.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M93100248

Have any Question?


Related Questions in Computer Engineering

Systems requirements and analysisyou have been hired to

Systems requirements and analysis You have been hired to lead a software project to design a Library Management System (LMS) for your local library at Jonesville. The library has been managed manually using written docum ...

A sample of 36 us households is taken and the average

A sample of 36 U.S. households is taken and the average amount of newspaper garbage or recycling is found to be 27.8 pounds with a standard deviation of 2 pounds. Estimate, with 99% confidence, the mean amount of newspap ...

Suppose that relations r and s contain 20 and 30 blocks

Suppose that relations r and s contain 20 and 30 blocks respectively, and the block nested-loop join algorithm is used to natural-join r and s. What is the cost in terms of number of seeks and number of block transfers i ...

Question 1 what is rdbms2 what is key-value pair

Question: 1. What is RDBMS? 2. What is Key-Value Pair Databases? 3. What are the foundational behaviors of MapReduce? The response must be typed, single spaced, must be in times new roman font (size 12) and must follow t ...

Suppose you take out a loan for 9000 at 12 ordinary

Suppose you take out a loan for $9,000, at 12% ordinary interest. If the amount of interest is $762.00, what is the time period? (Round any fraction to the next higherday)

With regards to data mining business analytics why is it

With regards to data mining/ business analytics, Why is it not ideal to evaluate a classifier's performance on the training data set?

Describe the role of an ethical hacker and describe what

Describe the role of an ethical hacker and describe what you can do legally as an ethical hacker

What conclusions can you draw about the heat of solution

What conclusions can you draw about the heat of solution for the three salts tested and the effect on the temperature changes when the salts were dissolved in water? Your answer should include the words Endothermic and E ...

The formulas a rarr b and c and a rarr b and a rarr c are

The formulas A → (B ∧ C) and (A → B) ∧ (A → C) are logically equivalent. For this problem, you are going to prove that they are equivalent in two different ways. Prove that A → (B ∧ C) ≡ (A → B) ∧ (A → C) by writing two ...

Suppose the information content of a packet is the ascii

Suppose the information content of a packet is the ASCII (8-bit code) representation of "OK" and an even parity scheme is being used. What would the value of the field containing the parity bits be for the case of a two- ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As