Question: my code compiles fine, but when i call the - strip(input.txt,output.txt); stdIn:2.1-2.32 Error: operator and operand do not agree [tycon mismatch] operator domain: string operand:

my code compiles fine, but when i call the - strip("input.txt","output.txt"); stdIn:2.1-2.32 Error: operator and operand do not agree [tycon mismatch] operator domain: string operand: string * string in expression: strip ("input.txt","output.txt") - strip'("input.txt","output.txt")'; stdIn:2.19 Error: illegal token

i get this error.

How do I fix this!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!11111

open TextIO

fun strip (inputFile:string) (outputFile:string) : unit =

let

val input = TextIO.openIn inputFile

(* open the output file for writing *)

val output = TextIO.openOut outputFile

fun processLine (line: string option) : unit =

(* check if the end of the file has been reached *)

if line = NONE then

(* close the input and output files *)

(TextIO.closeIn input; TextIO.closeOut output)

else

let val str = valOf(line)

in

(* check if the line is empty *)

if str = "" then

(* if empty, move to the next line *)

processLine (TextIO.inputLine input)

(* check if the line can be converted to an integer *)

else if Int.fromString(str) <> NONE then

(* if it can be converted, convert it and write it to the output file *)

(TextIO.output (output, (Int.toString (valOf (Int.fromString str))));

processLine (TextIO.inputLine input))

else

(* if it can't be converted, move to the next line *)

processLine (TextIO.inputLine input)

end

in

(* start processing the input file from the first line *)

processLine (TextIO.inputLine input)

end

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!