CSE502  Functional Programming                             Assignment # 3
Assigned: Oct. 13, 2004           Due, in class: Wednesday, Oct. 20, 2004

Be sure and include a listing (1-2 pages) which shows how you tested
your programs in the Hugs system.

1) Write a function "wordsL" such that (wordsL "This is a sentence.")
returns ["This", "is","a","sentence."]. It breaks a string into a list
of strings. It breaks the strings (and throws away the separators) at
blanks ( ' ' ), tabs ( '\t' ), and newlines ( '\n' ).  Hint: takeWhile
and dropWhile are very useful.  e.g. (takeWhile even [2,4,5,6,7]) =>
[2,4]. There is a function called words in the prelude that does exactly
this. Write your own version.

2) Exercise 3.1 page 42 of the text

3) Use the IO monad to write a function when given two strings as
input, opens a file with the first strings name, and copys it to
another file, with the name of the second string.
  copy :: String -> String -> IO ()

Be sure and test your function in the input you hand in.

4) Write a program "pal" which reads a string from the user, and then
prints on the screen if that string is a palindrome.  (A palindrome is
a string which reads the same both forwards and backwards.  For
example "hah" and "abCba".)  pal :: IO ()

5) Using the primitive drawing functions of chapter 4 of the text,
open a graphics window and draw a picture of a "house".