Haskell help!

Weix, Rachel Lynn weixrl@uwec.edu
Mon, 24 Mar 2003 18:32:54 -0600


This is a multi-part message in MIME format.

------_=_NextPart_001_01C2F266.132C29AC
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Hi,
=20
I'm a college student trying to write a Haskell program, and I'm having
some problems getting the correct output.  I need to write a program
which will return a set of optimally aligned sequences, with "optimal"
being defined as such: mismatch or space (represented by a "-") =3D -1;
else 1 for every pair (see below for what a pair is)
=20
An example set of sequences with an alignment of -3 is as follows:
=20
sc-h-e-me
icecream-
=20
(s,i) are a pair, (c, c), etc.
=20
For right now, I'm only returning a potential solution (vs. a set of
solutions), and I'm having problems with any set of sequences that
aren't the same length.  My results are listed below.  I don't want to
include the code for now since it's about a page long (printed out) but
was hoping maybe someone had an idea as to why I'm getting such odd
results?  If code will help, I can exchange back and forth with whoever
thinks they might be able to help me out.  Your help is much
appreciated!
=20
Rachel
=20
=20
-- Each word/sequence you see has been predefined in my Haskell code
-- This first example appears to work just fine
=20
Main> printSeq icecream scheme

("icecream", "scheme--")

=20

Main> printSeq hate hatter

("hat-e", "hatte")



Main> printSeq scheme saturn

("scheme", "saatur")



Main> printSeq saturn scheme

("saaturn", "scheme-")



Main> printSeq saturn hatter

("saaturn", "hatter-")



Main> printSeq hatter saturn

("hatter", "saatur")



Main> printSeq mad saturn

("mad", "saa")



Main> printSeq hate hatter

("hat-e", "hatte")



Main> printSeq snowball icecream

("snowb-all", "icecream-")



Main> printSeq mad computer

("--mad", "compu")

=20

Main> printSeq mad snowball

("mad", "sno")


------_=_NextPart_001_01C2F266.132C29AC
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Message</TITLE>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii">
<META content=3D"MSHTML 6.00.2800.1106" name=3DGENERATOR></HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D681582100-25032003>Hi,</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D681582100-25032003></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D681582100-25032003>I'm a =
college=20
student trying to write a Haskell program, and I'm having some problems =
getting=20
the correct output.&nbsp; I need&nbsp;to write a program which will =
return a set=20
of optimally aligned sequences, with "optimal" being defined as such:=20
</SPAN></FONT><FONT face=3DArial size=3D2><SPAN =
class=3D681582100-25032003>mismatch or=20
space (represented by a "-")&nbsp;=3D -1; else 1 for every pair (see =
below for=20
what a pair is)</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D681582100-25032003></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D681582100-25032003>An =
example set of=20
sequences with an alignment of -3 is as follows:</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D681582100-25032003></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D681582100-25032003>sc-h-e-me</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D681582100-25032003>icecream-</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D681582100-25032003></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D681582100-25032003>(s,i) =
are a pair,=20
(c, c), etc.</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D681582100-25032003></SPAN></FONT>&nbsp;</DIV>
<DIV><SPAN class=3D681582100-25032003><FONT face=3DArial size=3D2>For =
right now, I'm=20
only returning a potential solution (vs. a set of solutions), and I'm =
having=20
problems with any set of sequences that aren't the same length.&nbsp; My =
results=20
are listed below.&nbsp; I don't want to include the code for now since =
it's=20
about a page long (printed out) but was hoping maybe someone had an idea =
as to=20
why I'm getting such odd results?&nbsp; If code will help, I can =
exchange back=20
and forth with whoever thinks they might be able to help me out.&nbsp; =
Your help=20
is much appreciated!</FONT></SPAN></DIV>
<DIV><SPAN class=3D681582100-25032003><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D681582100-25032003><FONT face=3DArial=20
size=3D2>Rachel</FONT></SPAN></DIV>
<DIV><SPAN class=3D681582100-25032003><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D681582100-25032003><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D681582100-25032003><FONT face=3DArial size=3D2>-- =
Each=20
word/sequence you see&nbsp;has been predefined in my Haskell=20
code</FONT></SPAN></DIV>
<DIV><SPAN class=3D681582100-25032003><FONT face=3DArial size=3D2>-- =
This first=20
example appears to work just fine</FONT></SPAN></DIV>
<DIV><SPAN class=3D681582100-25032003></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D681582100-25032003><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in =
0pt"><SPAN><STRONG>Main&gt;</STRONG>=20
printSeq icecream scheme<?xml:namespace prefix =3D o ns =3D=20
"urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">(&#8220;icecream&#8221;, =
&#8220;scheme<SPAN=20
class=3D681582100-25032003>--</SPAN>&#8221;)</SPAN></P></SPAN>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><B=20
style=3D"mso-bidi-font-weight: normal"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial"></SPAN></B>&nbsp;</P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><B=20
style=3D"mso-bidi-font-weight: normal"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Main&gt;</SPAN></B><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial"> printSeq hate=20
hatter<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">(&#8220;hat<SPAN=20
class=3D681582100-25032003>-</SPAN>e&#8221;, &#8220;hatte&#8221;)<BR=20
style=3D"mso-special-character: line-break"><BR=20
style=3D"mso-special-character: line-break"><o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><B=20
style=3D"mso-bidi-font-weight: normal"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Main&gt;</SPAN></B><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial"> printSeq scheme=20
saturn<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">(&#8220;scheme&#8221;, =
&#8220;saatur&#8221;)<BR=20
style=3D"mso-special-character: line-break"><BR=20
style=3D"mso-special-character: line-break"><o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><B=20
style=3D"mso-bidi-font-weight: normal"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Main&gt;</SPAN></B><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial"> printSeq saturn=20
scheme<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">(&#8220;saaturn&#8221;, =
&#8220;scheme<SPAN=20
class=3D681582100-25032003>-</SPAN>&#8221;)<BR=20
style=3D"mso-special-character: line-break"><BR=20
style=3D"mso-special-character: line-break"><o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><B=20
style=3D"mso-bidi-font-weight: normal"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Main&gt;</SPAN></B><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial"> printSeq saturn=20
hatter<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">(&#8220;saaturn&#8221;, =
&#8220;hatter<SPAN=20
class=3D681582100-25032003>-</SPAN>&#8221;)<BR=20
style=3D"mso-special-character: line-break"><BR=20
style=3D"mso-special-character: line-break"><o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><B=20
style=3D"mso-bidi-font-weight: normal"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Main&gt;</SPAN></B><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial"> printSeq hatter=20
saturn<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">(&#8220;hatter&#8221;, =
&#8220;saatur&#8221;)<BR=20
style=3D"mso-special-character: line-break"><BR=20
style=3D"mso-special-character: line-break"><o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><B=20
style=3D"mso-bidi-font-weight: normal"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Main&gt;</SPAN></B><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial"> printSeq mad=20
saturn<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">(&#8220;mad&#8221;, =
&#8220;saa&#8221;)<BR=20
style=3D"mso-special-character: line-break"><BR=20
style=3D"mso-special-character: line-break"><o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><B=20
style=3D"mso-bidi-font-weight: normal"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Main&gt;</SPAN></B><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial"> printSeq hate=20
hatter<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">(&#8220;hat<SPAN=20
class=3D681582100-25032003>-</SPAN>e&#8221;, &#8220;hatte&#8221;)<BR=20
style=3D"mso-special-character: line-break"><BR=20
style=3D"mso-special-character: line-break"><o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><B=20
style=3D"mso-bidi-font-weight: normal"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Main&gt;</SPAN></B><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial"> printSeq snowball=20
icecream<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">(&#8220;snowb<SPAN=20
class=3D681582100-25032003>-</SPAN>all&#8221;, &#8220;icecream<SPAN=20
class=3D681582100-25032003>-</SPAN>&#8221;)<BR=20
style=3D"mso-special-character: line-break"><BR=20
style=3D"mso-special-character: line-break"><o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><B=20
style=3D"mso-bidi-font-weight: normal"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Main&gt;</SPAN></B><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial"> printSeq mad=20
computer<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">(&#8220;<SPAN=20
class=3D681582100-25032003>--</SPAN>mad&#8221;, =
&#8220;compu&#8221;)<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial"><o:p>&nbsp;</o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><B=20
style=3D"mso-bidi-font-weight: normal"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Main&gt;</SPAN></B><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial"> printSeq mad=20
snowball<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">(&#8220;mad&#8221;,=20
&#8220;sno&#8221;)</SPAN></P></SPAN></DIV></BODY></HTML>
=00
------_=_NextPart_001_01C2F266.132C29AC--