| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| Hi I am new in this forum and new to SML as well. I need to write a program that checks target words in a text file against a dictionary of correct spellings. If the target word is in the dictionary, it is output to the screen or to an output file. If the target word is not in the dictionary, a list of 'suggestions' is produced which contains words from the dictionary that closely resemble the target word. This is what i have done so far: open TextIO; fun inputStringList (fname : string) = let val instr = openIn fname val inputList = String.tokens Char.isSpace (inputLine instr) val dict = openIn "Dictionary.txt" val dictList = String.tokens Char.isSpace (inputLine dict) fun member([], h2::t2) = (output(stdOut,"End of file\n"); flushOut stdOut) | member(h1::t1, h2::t2) = if (h1 = h2) then (output(stdOut,h1^"\n"); flushOut stdOut) andalso member(t1,t2) else if (h1 <> h2) then member(h1,t2) in member(inputList, dictList) before closeIn(instr) before closeIn(dict) end; I encountered the error below when compiling what I have written above stdIn:46.1-47.8 Error: syntax error: deleting IN ID I would like to know how to correct the error and continue from then on. Thanks in advance for any suggestions and advice given. |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.