Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I do not understand SML/NJ as much as I need to, so could you please comment the code explaining why. Thanks in advance. Project 1:

I do not understand SML/NJ as much as I need to, so could you please comment the code explaining why. Thanks in advance.

image text in transcribed

Project 1: ML Parsing Write ML functions that will read a file containing positive integers, will sum all the integers found in that file, and return the sum to the environment. The following are the specifications. The main function the user will call shall be named filesum, which should have the type string -> int. It will take the user's filename as a string and return the sum of the integers in the file. The user will not call any other functions you write. You may assume the integers in the file are positive only. You can open the Textil, structure in your code. You must get permission if there are other structures or library functions you intend to use. You must use the functional/recursive programming style where appropriate. Do not use loops or other procedural techniques. To assist in readability, break up tasks by writing helper functions when possible. For example, you can create a function named isDigit; char -> bool which receives characters and returns true if it is a character between 0 and 9 and returns false otherwise. Comment your code briefly but thoroughly. | Be prepared to set an office appointment for a presentation/demonstration/defense of your project. Your file should be able to do: Your code can handle files where the integers can be any number of digits and are separated by one or more characters that are not digits located in multiples lines of the file. The last integer read may or may not be followed by one more non-digits before the end of the file is reached. The organization, layout, and commenting of your code/functions is clear and precise in helping the reader understand all of its components. Project 1: ML Parsing Write ML functions that will read a file containing positive integers, will sum all the integers found in that file, and return the sum to the environment. The following are the specifications. The main function the user will call shall be named filesum, which should have the type string -> int. It will take the user's filename as a string and return the sum of the integers in the file. The user will not call any other functions you write. You may assume the integers in the file are positive only. You can open the Textil, structure in your code. You must get permission if there are other structures or library functions you intend to use. You must use the functional/recursive programming style where appropriate. Do not use loops or other procedural techniques. To assist in readability, break up tasks by writing helper functions when possible. For example, you can create a function named isDigit; char -> bool which receives characters and returns true if it is a character between 0 and 9 and returns false otherwise. Comment your code briefly but thoroughly. | Be prepared to set an office appointment for a presentation/demonstration/defense of your project. Your file should be able to do: Your code can handle files where the integers can be any number of digits and are separated by one or more characters that are not digits located in multiples lines of the file. The last integer read may or may not be followed by one more non-digits before the end of the file is reached. The organization, layout, and commenting of your code/functions is clear and precise in helping the reader understand all of its components

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts Of Database Management

Authors: Joy L. Starks, Philip J. Pratt, Mary Z. Last

9th Edition

1337093424, 978-1337093422

More Books

Students also viewed these Databases questions