CS- Haskell Language Lab 3 Solution

$30.00 $24.00

Overview You will write a program in Haskell which has the same functionality as the C Lab spell check program. In this lab you will not be doing any pipes, forks, execs, or signals. You will read input from a le and check all the words for spelling, you will read a dictionary le which…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Description

5/5 – (2 votes)

Overview

You will write a program in Haskell which has the same functionality as the C Lab spell check program. In this lab you will not be doing any pipes, forks, execs, or signals. You will read input from a le and check all the words for spelling, you will read a dictionary le which has correct spelling for its words, one word per line in alphabetic order. In the lab, you will write your results to a le. This is a 40 point program.

Speci cs

You will write all of your code in one module in one le. You will have three command line arguments in this order: input le, dictionary le, output le. You will be writing the code to do input and output in this program.

Your program will take all words from the input le and sort them alphabetically. You will only keep unique words from the input le. A word is de ned as a sequence of alphabetic characters. Note that this means every character which is not alphabetic is not part of a word, so each sequence of nonalphabetic characters will be skipped over. Also note that your program will not change the case of the words input, so that on output the word sent to the output le will be the same as the input word in the case of the individual letters. Note that if your input le has two words that are the same except for the case of the letters, you will only keep one of those words for processing. For example, if your input le contains ’cat’ and ’Cat’, only one of these will be kept for processing. If your program contains the word ’Dog’ only once and in this form, the string ’Dog’ will be kept for processing, not ’dog’.

Your program will compare each word from input with the words in the dictionary. Since both are sorted alphabetically, this comparison process will be e cient. Your code will make use of the alphabetic orderings of the input and dictionary.

1

Notes

In the Main module for lab 2 in Haskell, I provided code in which each line was read separately. You may want to consider writing code in which the entire le is read with one call to a Haskell input function.

Remember that the Data.Char module has some functions on characters which might be useful.

Note that since we are not using just white space to separate words, the Haskell function words will not work for taking words from the input.

Use the dictionary le that was provided for the spell check program in C.

Deliverables

Your source code le and input data le(s) must be submitted via Blackboard no later than 11:59:59 p.m. Friday May 24.

2

CS- Haskell Language Lab 3 Solution
$30.00 $24.00