Question
(* this code is named a2.sml, when loading it into my sml enviornment, I am getting these error messages [opening a2.sml] a2.sml:5.5 Error: syntax error:
(* this code is named a2.sml, when loading it into my sml enviornment, I am getting these error messages
[opening a2.sml] a2.sml:5.5 Error: syntax error: inserting VAL a2.sml:6.5 Error: syntax error: inserting VAL a2.sml:7.5-7.8 Error: syntax error: replacing REC with FUN a2.sml:8.9 Error: syntax error: inserting VAL a2.sml:9.16-10.6 Error: syntax error: deleting WITH BAR a2.sml:10.7 Error: syntax error: inserting COLON a2.sml:11.5 Error: syntax error: replacing BAR with COLON a2.sml:12.32-13.10 Error: syntax error: deleting WITH BAR a2.sml:13.39 Error: syntax error: inserting SEMICOLON a2.sml:14.9-14.18 Error: syntax error: deleting BAR IDA ARROW a2.sml:14.19 Error: syntax error: inserting END a2.sml:18.1 Error: syntax error found at EOF [unexpected exception: Compile]
*) (*please help!!!!!!!!!!!!*)
fun strip (inputFile:string, outputFile:string) : unit =
let input = TextIO.openIn inputFile in
let output = TextIO.openOut outputFile in
let rec processLine () =
let line = TextIO.inputLine input in
match line with
| None -> TextIO.closeIn input; TextIO.closeOut output
| Some s ->
match Int.fromString s with
| Some i -> TextIO.outputLine output (Int.toString i); processLine()
| None -> processLine()
in
processLine();
TextIO.closeIn input;
TextIO.closeOut output
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