Write a function sum_rows: int list list -> int list that takes a list of int...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a function sum_rows: int list list -> int list that takes a list of int lists (call an internal list a "row") and returns a one-dimensional list of ints, each int equal to the sum of the corresponding row in the input. let sum_rows (rows:int list list) : int list = (* YOUR CODE HERE *) assert (sum_rows [[1; 2]; [3;4]] = [3; 7]); assert (sum_rows [[5; 6; 7; 8; 9]; [10]] = [35; 10]) Write a function sum_rows: int list list -> int list that takes a list of int lists (call an internal list a "row") and returns a one-dimensional list of ints, each int equal to the sum of the corresponding row in the input. let sum_rows (rows:int list list) : int list = (* YOUR CODE HERE *) assert (sum_rows [[1; 2]; [3;4]] = [3; 7]); assert (sum_rows [[5; 6; 7; 8; 9]; [10]] = [35; 10])
Expert Answer:
Related Book For
Posted Date:
Students also viewed these programming questions
-
9.1 Exercise (JDK Source Code): Extract the source code of the class Math from the JDK source code ("$JAVA_HOME" "src.zip" "Math.java" under folder "java.lang"). Study how constants such as E and...
-
. A vertical pole that is 2 meters tall casts a shadow that is 1.5 meters long. Nearby, at the same time, another vertical pole casts a shadow that is 6.5 meters long. How tall is this pole? a. Make...
-
Two-dimensional array operations: Movie Ratings program ** You have recently collected reviews from four movie reviewers where the reviewers are numbered 1-4. Each reviewer has rated six movies where...
-
11. Calculate the expected return and standard deviation for the risky portfolio on the CAL (with or without borrowing) and for the investor's complete portfolio on the CAL. 8(,1)% Std dev= 30 25 18...
-
An alternating copolymer is known to have a number-average molecular weight of 100,000 g/mol and a degree of polymerization of 2210. If one of the repeat units is ethylene, which of styrene,...
-
Stephanie Baskill, an unemployed accounting clerk, lives one block from Cleaver Manufacturing Company. While walking her dog last year, she noticed some ERP manuals in the dumpsters. Curious, she...
-
The forward difference formulas make use of the values of the function to the right of the base grid point. Thus the first derivative at point \(i\left(t=t_{i} ight)\) is defined as \[\frac{d x}{d...
-
1. Lastovica Construction is insured under a commercial general liability (CGL) policy. The firm agreed to build a new manufacturing facility for the Smith Corporation. A heavy machine used by...
-
List and analyze the reasons why a firm may actually be operating in stage I or stage III of the short-run production function?
-
6.2. Data has been collected from a chemical reactor. The inlet concentration was the only input variable that changed when the data was collected. The input and output data is given in Table Q6.2....
-
Write an essay on Feds View on Inflation is Quietly Shifting. Heres why.
-
Equity equals: A. Assets Liabilities. B. Liabilities Assets. C. Assets + Liabilities.
-
Red Road Company, a consulting company, reported total revenues of $100 million, total expenses of $80 million, and net income of $20 million in the most recent year. If accounts receivable increased...
-
International financial reporting standards are currently developed by which entity? A. The IFRS Foundation. B. The International Accounting Standards Board. C. The International Organization of...
-
Silverago Incorporated, an international metals company, reported a loss on the sale of equipment of $2 million in 2010. In addition, the companys income statement shows depreciation expense of $8...
-
Which of the following is an example of a financing activity on the cash flow statement under US GAAP? A. Payment of interest. B. Receipt of dividends. C. Payment of dividends.
-
You have clients who are in the market for a new car and real estate. Both purchases require loans. The car purchase will be for an Electric Vehicle (EV). The cost of the vehicle is $60000. This...
-
SCHEDULE OF COST OF GOODS MANUFACTURED The following information is supplied for Sanchez Welding and Manufacturing Company. Prepare a schedule of cost of goods manufactured for the year ended...
-
In Listing 6.10, what advantage would there be in using character labels, such as a and c, instead of numbers for the menu choices and switch cases? Here is a sample run of the executive menu program...
-
Suppose a base class and a derived class both define a method with the same name and a derived-class object invokes the method. What method is called?
-
You sell the book C++ for Fools. Write a program that has you enter a years worth of monthly sales (in terms of number of books, not of money).The program should use a loop to prompt you by month,...
-
A floating 40-in.-thick piece of ice sinks 1 in. with a \(500-\mathrm{lb}\) polar bear in the center of the ice. What is the area of the ice in the plane of the water level? For seawater, \(S=1.03\).
-
Obtain a photograph/image of a situation in which Archimedes's principle is important. Print this photo and write a brief paragraph that describes the situation involved.
-
A spherical balloon filled with helium at \(40^{\circ} \mathrm{F}\) and \(20 \mathrm{psia}\) has a 25 - \(\mathrm{ft}\) diameter. What load can it support in atmospheric air at \(40^{\circ}...
Study smarter with the SolutionInn App