layout problem

Γιώργος Κοσμίδης gkosmidis@epsilon7.gr
Wed, 18 Sep 2002 16:32:35 +0300


This is a multi-part message in MIME format.

------=_NextPart_000_0086_01C25F30.FEC22340
Content-Type: text/plain;
	charset="iso-8859-7"
Content-Transfer-Encoding: quoted-printable

Hello everyone.
I have a problem with a assessment.
The problem is with the layout.
I cannot understand what is wrong.
Here is the code
module Main where
import IO
import System
import List
import Maybe
import Char
import Numeric

type Word=3DString
type WordCount=3DInt
type WordTup=3D(word,wordCount)
type WordList=3D[WordTup]

main=3Ddo args<-getArgs
        textLines<-getText
        switchArgs args textLines
        where
        switchArgs args textLines
          |(isMemberOf "-f" args) && (isMemberOf "-i" args)
                         =3DprintFreq(sortWordCount(parseLcLine =
textLines))
                        |(isMemberOf "-f" args)
                         =3DprintFreq(sortWordCount (parseLine =
textLines))
                        |(isMemberOf "-i" args)
                         =3DprintFreq(sortWordCount (parseLcLine =
textLines))
                        |otherwise
                         =3DprintFreq(sortName (parseLine textLines))
        getText::IO String
        getText=3Ddo c<-getChar
                   e<-isEOF
                   if (e)
                then return "" else
                       (do nc<-getText
                           return (:nc))
        parseLine::String->Wordlist
        parseLine line
                  |(line/=3D"")&&(isWantedChar (headline))
                   =3DfillWordList w(parseLine newLine)
                  |(line/=3D"")&&(not(isWantedChar (headline)))
                   =3DparseLine(tail line)

        isMemberOf::String->[String]->Bool
        isMemberOf arg args=20
                   =3D[]/=3D[a|a<-args,a=3D=3Darg]

        printFreq::WordList->IO()
        printFreq wl=3Ddo sequence (map putWordStat wl)
                        where=20
                        putWordStat(Word,WordCount)->IO()
                        putWordStat(w,wc)
                        do putStr w
                           putSpc (20 (length w) (length(show wc)))
                           putStr (show wc)
                           putSpc 8
                           putStr (showFFloat (Just 2) (fromIntegral =
(wc) * 100.0/fromIntegral (wLength))"")
                           putChar '%'
                           putChar '\n'
                        return()
                        wlLength-countWords wl;

        putSpc::Int->IO()
        putSpc n
               |n>1 do putChar ''
                       putSpc (n-1)
                return()
               |otherwise=3DputChar ''

        countWords:Wordlist->Int
        countWords [ ]
        countWords ((w,wc):wl)=3Dwc+countWords wl
        sortName::WordList->WordList
        sortName [ ] =3D [ ]=20
        sortName (wn:ws)=3DsortName [(w,wc) (w,wc) <-ws,not (isGreater =
(w,wc)wc)]
                  ++[wn]++sortName[(w,wc)|(w,wc)<-ws, isGreater (w,wc) =
wn]
                  where
                  isGreater (wl,wcl) (w2,wc2)
                             |ord(head(wl))-ord(head(x2))>0=3DTrue
                             |ord(head(wl))-ord(head(x2))<0=3DFalse
                             |length wl>l && length w2>l
                              =3DisGreater(tail(wl),wcl) (tail(w2,wc2)
                             |otherwise =3D []
                             where
                             w=3DparseWord line
                             newline=3Ddrop (length w) line
        parseLcLine::String->WordList
        parseLcLine line
                    |(line/=3D"") && (isWantedChar (head =
line))=3DfillWordList w (parseLcLine newline)
                    |(line/=3D"") && (not (isWantedChar (head =
line)))=3DparseLcLine (tail line)
                    |otherwise =3D []
                    where
                    w=3Dmap toLower (parseWord line)
                    newline=3Ddrop (lenfth w) line
        parseWord::Word->Word
        parseWord w
                  |(w/=3D"") && (isWantedChar (head w))=3D(head w): =
parseWord (tail w))
                  |otherwise =3D ""

        isWantedChar::Char->Bool
        isWantedChar c
                     | (c=3D=3D'a'|| c=3D=3D'b'|| c=3D=3D'c'|| =
c=3D=3D'd'|| c=3D=3D'e'|| c=3D=3D'f'|| c=3D=3D'g'|| c=3D=3D'h'|| =
c=3D=3D'i'||  c=3D=3D'j'|| c=3D=3D'k'|| c=3D=3D'l'|| c=3D=3D'm'|| =
c=3D=3D'n'|| c=3D=3D'o'|| c=3D=3D'p'|| c=3D=3D'q'|| c=3D=3D'r'|| =
c=3D=3D's'|| c=3D=3D't'|| c=3D=3D'u'|| c=3D=3D'v'|| c=3D=3D'w'|| =
c=3D=3D'x'|| c=3D=3D'y'|| c=3D=3D'z'||c=3D=3D'A'|| c=3D=3D'B'|| =
c=3D=3D'C'|| c=3D=3D'D'|| c=3D=3D'E'|| c=3D=3D'F'|| c=3D=3D'G'|| =
c=3D=3D'H'|| c=3D=3D'I'||  c=3D=3D'J'|| c=3D=3D'K'|| c=3D=3D'L'|| =
c=3D=3D'M'|| c=3D=3D'N'|| c=3D=3D'O'|| c=3D=3D'P'|| c=3D=3D'Q'|| =
c=3D=3D'R'|| c=3D=3D'S'|| c=3D=3D'T'|| c=3D=3D'U'|| c=3D=3D'V'|| =
c=3D=3D'W'|| c=3D=3D'X'|| c=3D=3D'Y'|| c=3D=3D'Z'|| =3D True)
                     |otherwise =3D False
       fillWordList::Word->WordList->WordList
       fillWordList w wordlistl
                    |cWord/=3D [] =
=3DcWord++[wordl,wordCountl)|(wordl,wordCountl<-wordListl,wordl/=3Dw]
                    |otherwise =3D (w,l):wordListl
                    where
                    cWord=3D[(wordl,(wordCountl-l)) | =
(wordl,wordCountl)<-wordListl,wordl=3D=3Dw]
                                                  |length w1>1 && length =
w2=3D=3D1=3DTrue
                                                  |otherwise =3D False
        sortWordCount::WordList->WordList
        sortWordCount [] =3D []
        sortWordCount ((wn,wcn):ws=3DsortWordCount =
[(w,wc|cw,wc)<-ws,ws<=3Dwvn++=20
                       [(wn,wcn)]++sortWordCount =
[(cw,wc)|(w,wc)<-ws,wcs,wcn]



------=_NextPart_000_0086_01C25F30.FEC22340
Content-Type: text/html;
	charset="iso-8859-7"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-7" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.3504.2500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT color=3D#0000ff face=3D"Comic Sans MS" size=3D2>Hello=20
everyone.</FONT></DIV>
<DIV><FONT color=3D#0000ff face=3D"Comic Sans MS" size=3D2>I have a =
problem with a=20
assessment.</FONT></DIV>
<DIV><FONT color=3D#0000ff face=3D"Comic Sans MS" size=3D2>The problem =
is with the=20
layout.</FONT></DIV>
<DIV><FONT color=3D#0000ff face=3D"Comic Sans MS" size=3D2>I cannot =
understand what is=20
wrong.</FONT></DIV>
<DIV><FONT color=3D#0000ff face=3D"Comic Sans MS" size=3D2>Here is the=20
code</FONT></DIV>
<DIV><FONT color=3D#0000ff face=3D"Comic Sans MS" size=3D2>module Main =
where<BR>import=20
IO<BR>import System<BR>import List<BR>import Maybe<BR>import =
Char<BR>import=20
Numeric</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT color=3D#0000ff face=3D"Comic Sans MS" size=3D2>type =
Word=3DString<BR>type=20
WordCount=3DInt<BR>type WordTup=3D(word,wordCount)<BR>type=20
WordList=3D[WordTup]</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT color=3D#0000ff face=3D"Comic Sans MS" size=3D2>main=3Ddo=20
args&lt;-getArgs<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
textLines&lt;-getText<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
switchArgs=20
args textLines<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
where<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; switchArgs args=20
textLines<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
|(isMemberOf=20
"-f" args) &amp;&amp; (isMemberOf "-i"=20
args)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;=20
=3DprintFreq(sortWordCount(parseLcLine=20
textLines))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;=20
|(isMemberOf "-f"=20
args)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;=20
=3DprintFreq(sortWordCount (parseLine=20
textLines))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;=20
|(isMemberOf "-i"=20
args)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;=20
=3DprintFreq(sortWordCount (parseLcLine=20
textLines))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;=20
|otherwise<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;=20
=3DprintFreq(sortName (parseLine=20
textLines))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; get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line))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
=3DfillWordList w(parseLine=20
newLine)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
|(line/=3D"")&amp;&amp;(not(isWantedChar=20
(headline)))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
=3DparseLine(tail line)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT color=3D#0000ff face=3D"Comic Sans MS"=20
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
isMemberOf::String-&gt;[String]-&gt;Bool<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;=20
isMemberOf arg args=20
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
=3D[]/=3D[a|a&lt;-args,a=3D=3Darg]</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT color=3D#0000ff face=3D"Comic Sans MS"=20
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
printFreq::WordList-&gt;IO()<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;=20
printFreq wl=3Ddo sequence (map putWordStat=20
wl)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp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"Comic Sans MS"=20
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
putSpc::Int-&gt;IO()<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
putSpc=20
n<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;=20
|n&gt;1 do putChar=20
''<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
putSpc=20
(n-1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;=20
return()<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;=20
|otherwise=3DputChar ''</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT color=3D#0000ff face=3D"Comic Sans MS"=20
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
countWords:Wordlist-&gt;Int<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
=20
countWords [ ]<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; countWords=20
((w,wc):wl)=3Dwc+countWords =
wl<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
sortName::WordList-&gt;WordList<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;=20
sortName [ ] =3D [ ] <BR>&nbsp;&nbsp;&nbsp;&nbsp;&n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&nbsp;&nbsp;=20
newline=3Ddrop (length w) =
line<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
parseLcLine::String-&gt;WordList<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;=20
parseLcLine=20
line<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
|(line/=3D&#8221;&#8221;) &amp;&amp; (isWantedChar (head =
line))=3DfillWordList w (parseLcLine=20
newline)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
|(line/=3D&#8221;&#8221;) &amp;&amp; (not (isWantedChar (head =
line)))=3DparseLcLine (tail=20
line)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
|otherwise =3D=20
[]<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
where<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
w=3Dmap toLower (parseWord=20
line)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
newline=3Ddrop (lenfth w) =
line<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
parseWord::Word-&gt;Word<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
parseWord=20
w<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
|(w/=3D&#8221;&#8221;) &amp;&amp; (isWantedChar (head w))=3D(head w): =
parseWord (tail=20
w))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
|otherwise =3D &#8220;&#8221;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT color=3D#0000ff face=3D"Comic Sans MS"=20
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
isWantedChar::Char-&gt;Bool<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
=20
isWantedChar=20
c<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
| (c=3D=3D&#8217;a&#8217;|| c=3D=3D&#8217;b&#8217;|| =
c=3D=3D&#8217;c&#8217;|| c=3D=3D&#8217;d&#8217;|| =
c=3D=3D&#8217;e&#8217;|| c=3D=3D&#8217;f&#8217;|| =
c=3D=3D&#8217;g&#8217;|| c=3D=3D&#8217;h&#8217;||=20
c=3D=3D&#8217;i&#8217;||&nbsp; c=3D=3D&#8217;j&#8217;|| =
c=3D=3D&#8217;k&#8217;|| c=3D=3D&#8217;l&#8217;|| =
c=3D=3D&#8217;m&#8217;|| c=3D=3D&#8217;n&#8217;|| =
c=3D=3D&#8217;o&#8217;|| c=3D=3D&#8217;p&#8217;||=20
c=3D=3D&#8217;q&#8217;|| c=3D=3D&#8217;r&#8217;|| =
c=3D=3D&#8217;s&#8217;|| c=3D=3D&#8217;t&#8217;|| =
c=3D=3D&#8217;u&#8217;|| c=3D=3D&#8217;v&#8217;|| =
c=3D=3D&#8217;w&#8217;|| c=3D=3D&#8217;x&#8217;|| =
c=3D=3D&#8217;y&#8217;||=20
c=3D=3D&#8217;z&#8217;||c=3D=3D&#8217;A&#8217;|| =
c=3D=3D&#8217;B&#8217;|| c=3D=3D&#8217;C&#8217;|| =
c=3D=3D&#8217;D&#8217;|| c=3D=3D&#8217;E&#8217;|| =
c=3D=3D&#8217;F&#8217;|| c=3D=3D&#8217;G&#8217;|| =
c=3D=3D&#8217;H&#8217;||=20
c=3D=3D&#8217;I&#8217;||&nbsp; c=3D=3D&#8217;J&#8217;|| =
c=3D=3D&#8217;K&#8217;|| c=3D=3D&#8217;L&#8217;|| =
c=3D=3D&#8217;M&#8217;|| c=3D=3D&#8217;N&#8217;|| =
c=3D=3D&#8217;O&#8217;|| c=3D=3D&#8217;P&#8217;||=20
c=3D=3D&#8217;Q&#8217;|| c=3D=3D&#8217;R&#8217;|| =
c=3D=3D&#8217;S&#8217;|| c=3D=3D&#8217;T&#8217;|| =
c=3D=3D&#8217;U&#8217;|| c=3D=3D&#8217;V&#8217;|| =
c=3D=3D&#8217;W&#8217;|| c=3D=3D&#8217;X&#8217;|| =
c=3D=3D&#8217;Y&#8217;||=20
c=3D=3D&#8217;Z&#8217;|| =3D=20
True)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
|otherwise =3D False<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
fillWordList::Word-&gt;WordList-&gt;WordList<BR>&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;=20
fillWordList w=20
wordlistl<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
|cWord/=3D []=20
=3DcWord++[wordl,wordCountl)|(wordl,wordCountl&lt;-wordListl,wordl/=3Dw]<=
BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
|otherwise =3D=20
(w,l):wordListl<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
where<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
cWord=3D[(wordl,(wordCountl-l)) |=20
(wordl,wordCountl)&lt;-wordListl,wordl=3D=3Dw]<BR>&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
|length w1&gt;1 &amp;&amp; length=20
w2=3D=3D1=3DTrue<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;=20
|otherwise =3D False<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
sortWordCount::WordList-&gt;WordList<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;=20
sortWordCount [] =3D []<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
sortWordCount ((wn,wcn):ws=3DsortWordCount =
[(w,wc|cw,wc)&lt;-ws,ws&lt;=3Dwvn++=20
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
[(wn,wcn)]++sortWordCount =
[(cw,wc)|(w,wc)&lt;-ws,wcs,wcn]<BR></FONT></DIV>
<DIV>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_0086_01C25F30.FEC22340--