Haskell help!

Weix, Rachel Lynn weixrl@uwec.edu
Wed, 26 Mar 2003 16:30:08 -0600


This is a multi-part message in MIME format.

------_=_NextPart_001_01C2F3E7.41B04132
Content-Type: multipart/alternative;
	boundary="----_=_NextPart_002_01C2F3E7.41B04132"


------_=_NextPart_002_01C2F3E7.41B04132
Content-Type: text/plain;
	charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

Currently I'm having problems with type checking due to Haskell being a =
strongly typed language.  In order to return all optimal solutions, my =
professor suggested I create a list of tuples if they all have the same =
score, as indicated in my new maxSeq method (see attachment).  However, =
this means that the maxSeq method would return type [[(Char,Char)]].  =
Since maxSeq and getSeq must return the same type, I end up changing all =
my signatures and end up with lots of problems.  In my caseX methods, I =
can't append [(Char)] to [[(Char,Char)]], and it also messes up trying =
to get my score of each tuple, etc.  I've been trying to solve the =
problem in Scheme first but even then I'm having problems, and Scheme is =
only loosely typed.  Any suggestions?  The format should be something =
like the following (partial example):
=20
[ [(-,M)] [(T,a)(h,s)(-,t)(e,e)(-,r)(-,s)] =
[(-,s)(h,t)(e,e)(-,r)(-,s)]]].=20
=20
Once I get back my list, I need to pair everything up in order to return =
a list of optimal solutions.  Taking the previous example, it would be =
the following when paired up correctly:
=20
[ [(-,M)(T,a)(h,s)(-,t)(e,e)(-,r)(-,s)], =
[(-,M)(T,a)(-,s)(h,t)(e,e)(-,r)(-,s)] ]=20
=20
>From there, I find which sequence has the maximum score.  I then walk =
through the list again, making a list of all the sequences that have =
that score.  These two steps seem fairly trivial, it's all the above =
stuff which I'm struggling on.
=20
Rachel
=20
-----Original Message-----=20
From: Marc Ziegert [mailto:coeus@gmx.de]=20
Sent: Tue 3/25/2003 3:13 PM=20
To: Weix, Rachel Lynn=20
Cc:=20
Subject: Re: Haskell help!



	maxSeq had one mistake: || instead of &&
=09
	i will think about the problem itself, before rewriting all.
=09
	this is the file a little bit more in haskell style.
=09
=09
=09
	Am Dienstag, 25. M=E4rz 2003 20:16 schrieben Sie:
	> I found my two mistakes, plus I fixed the method my Professor said =
was
	> incorrect.  Now I just have to be able to find ALL optimal solutions,
	> instead of just one.  Hooray!
	>
	> Rachel
=09


------_=_NextPart_002_01C2F3E7.41B04132
Content-Type: text/html;
	charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dwindows-1252">=0A=
=0A=
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">=0A=
<HTML>=0A=
<HEAD>=0A=
=0A=
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
6.0.6249.1">=0A=
<TITLE>Re: Haskell help!</TITLE>=0A=
</HEAD>=0A=
<BODY dir=3Dltr>=0A=
<DIV>Currently I'm having problems with type checking due to Haskell =
being a =0A=
strongly typed language.&nbsp; In order to return all optimal solutions, =
my =0A=
professor suggested I create a list of tuples if they all have the same =
score, =0A=
as indicated in my new maxSeq method (see attachment).&nbsp; However, =
this means =0A=
that the maxSeq method would return&nbsp;type [[(Char,Char)]].&nbsp; =
Since =0A=
maxSeq and getSeq must return the same type, I end up changing all my =
signatures =0A=
and end up with lots of problems.&nbsp; In my caseX methods, I can't =
append =0A=
[(Char)] to [[(Char,Char)]], and it also messes up trying to get my =
score of =0A=
each tuple, etc.&nbsp; I've been trying to solve the problem in Scheme =
first but =0A=
even then I'm having problems, and Scheme is only loosely typed.&nbsp; =
Any =0A=
suggestions?&nbsp; The format should be something like the following =
(partial =0A=
example):</DIV>=0A=
<DIV>&nbsp;</DIV>=0A=
<DIV>[ [(-,M)] [(T,a)(h,s)(-,t)(e,e)(-,r)(-,s)] =0A=
[(-,s)(h,t)(e,e)(-,r)(-,s)]]].&nbsp;</DIV>=0A=
<DIV>&nbsp;</DIV>=0A=
<DIV>Once I get back my list, I need to pair everything up in order to =
return a =0A=
list of optimal solutions.&nbsp; Taking the previous example, it would =
be the =0A=
following when paired up correctly:</DIV>=0A=
<DIV>&nbsp;</DIV>=0A=
<DIV>[ [(-,M)(T,a)(h,s)(-,t)(e,e)(-,r)(-,s)], =0A=
[(-,M)(T,a)(-,s)(h,t)(e,e)(-,r)(-,s)] ]&nbsp;</DIV>=0A=
<DIV>&nbsp;</DIV>=0A=
<DIV>From there, I find which sequence has the maximum score.&nbsp; I =
then walk =0A=
through the list again, making a list of all the sequences that have =
that =0A=
score.&nbsp; These two steps seem fairly trivial, it's all the above =
stuff which =0A=
I'm struggling on.</DIV>=0A=
<DIV>&nbsp;</DIV>=0A=
<DIV>Rachel</DIV>=0A=
<DIV>&nbsp;</DIV>=0A=
<DIV><FONT size=3D2>-----Original Message----- <BR><B>From:</B> Marc =
Ziegert =0A=
  [mailto:coeus@gmx.de] <BR><B>Sent:</B> Tue 3/25/2003 3:13 PM =
<BR><B>To:</B> =0A=
  Weix, Rachel Lynn <BR><B>Cc:</B> <BR><B>Subject:</B> Re: Haskell =0A=
  help!<BR><BR></DIV></FONT>=0A=
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px">=0A=
  <P><FONT size=3D2>maxSeq had one mistake: || instead of =
&amp;&amp;<BR><BR>i will =0A=
  think about the problem itself, before rewriting all.<BR><BR>this is =
the file =0A=
  a little bit more in haskell style.<BR><BR><BR><BR>Am Dienstag, 25. =
M=E4rz 2003 =0A=
  20:16 schrieben Sie:<BR>&gt; I found my two mistakes, plus I fixed the =
method =0A=
  my Professor said was<BR>&gt; incorrect.&nbsp; Now I just have to be =
able to =0A=
  find ALL optimal solutions,<BR>&gt; instead of just one.&nbsp; =0A=
  Hooray!<BR>&gt;<BR>&gt; Rachel<BR></FONT></P></BLOCKQUOTE>=0A=
=0A=
</BODY>=0A=
</HTML>
------_=_NextPart_002_01C2F3E7.41B04132--

------_=_NextPart_001_01C2F3E7.41B04132
Content-Type: application/octet-stream;
	name="prog1c.hs"
Content-Transfer-Encoding: base64
Content-Description: prog1c.hs
Content-Disposition: attachment;
	filename="prog1c.hs"

LS1TYW1wbGUgU2VxdWVuY2VzDQppY2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