Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Solve in Standard ML programming language. Note: Don't use chatgpt. That solution doesn't work. Write an ML function with name and type strip : (string
Solve in Standard ML programming language.
Note: Don't use chatgpt. That solution doesn't work.
Write an ML function with name and type strip : (string * string) unit that inputs the names of a file for reading and a file for writing. The input file will contain multiple lines of text of either integers or non-integers. Your function will write to the output file the same lines of text but with the non-integers removed. For example, if the input file is named input.txt and contains: 43 go 121 7 bulldogs 1234 Then your function should work as follows: -strip("input.txt","output.txt");valit=():unit And the output file named output.txt shall contain: 4312171234 Specifications/Notes: - You will not know the number of lines in the file in advance. - It is possible the file will be blank, in which case your function should create a blank output file. - You will not know the names of the files in advance. - You shall use Int.fromString and TextIO.inputLine to process the integers from the file. No other structures or library functions are allowed without explicit permission. - To assist in readability, break up tasks by writing helper functions when possible. - Comment your code briefly but thoroughly. NOTE: You must use the functional/recursive programming style with pattern matching where appropriate. Do not use loops, "global" variable bindings, or other procedural techniques (e.g., no huge "if-then-else" chains)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started