Fwd: Re: Haskell help!
Marc Ziegert
coeus@gmx.de
Thu, 27 Mar 2003 00:51:57 +0100
---------- Weitergeleitete Nachricht ----------
Subject: Re: Haskell help!
Date: Wed, 26 Mar 2003 23:57:42 +0100
From: Marc Ziegert <coeus@gmx.de>
To: "Weix, Rachel Lynn" <weixrl@uwec.edu>
i'm just programming the solution.
imagine a matrix / a rectangle with a grid:
the first word at the top side, the second at the right.
each entry takes the best solutions of your sequencing problem using just=
a
part of the words.
in the top right there is the entry for the two empty words:
(0,[ ("","") ])
the value is zero, the list has just one solution: ("","")
below this entry:
(-1,[ ("~","s") ])
at the bottom right:
(-7,[ ("~~~~~~~","Masters") ])
all this was the rightmost column.
the whole matrix is a list of columns - the head is the leftmost column.
the head of one column is the entry at the bottom.
the solution of the whole problem is at the bottom left - the head of the
head of the matrix.
- marc
Am Mittwoch, 26. M=E4rz 2003 23:32 schrieben Sie:
> P.S. The example given is for the set of sequences/strings (The,Master=
s)
>
> =09-----Original Message-----
> =09From: Weix, Rachel Lynn
> =09Sent: Wed 3/26/2003 4:30 PM
> =09To: coeus@gmx.de
> =09Cc: haskell@haskell.org
> =09Subject: RE: Haskell help!
>
>
> =09Currently I'm having problems with type checking due to Haskell bein=
g 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)]]. S=
ince
> 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 ca=
n'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 Sch=
eme
> first but even then I'm having problems, and Scheme is only loosely typ=
ed.
> Any suggestions? The format should be something like the following
> (partial example):
>
> =09[ [(-,M)] [(T,a)(h,s)(-,t)(e,e)(-,r)(-,s)] [(-,s)(h,t)(e,e)(-,r)(-,s=
)]]].
>
> =09Once I get back my list, I need to pair everything up in order to re=
turn a
> list of optimal solutions. Taking the previous example, it would be th=
e
> following when paired up correctly:
>
> =09[ [(-,M)(T,a)(h,s)(-,t)(e,e)(-,r)(-,s)],
> [(-,M)(T,a)(-,s)(h,t)(e,e)(-,r)(-,s)] ]
>
> =09From there, I find which sequence has the maximum score. I then wal=
k
> through the list again, making a list of all the sequences that have th=
at
> score. These two steps seem fairly trivial, it's all the above stuff w=
hich
> I'm struggling on.
>
> =09Rachel
>
> =09-----Original Message-----
> =09From: Marc Ziegert [mailto:coeus@gmx.de]
> =09Sent: Tue 3/25/2003 3:13 PM
> =09To: Weix, Rachel Lynn
> =09Cc:
> =09Subject: Re: Haskell help!
>
>
>
> =09=09maxSeq had one mistake: || instead of &&
>
> =09=09i will think about the problem itself, before rewriting all.
>
> =09=09this is the file a little bit more in haskell style.
>
> =09=09Am Dienstag, 25. M=E4rz 2003 20:16 schrieben Sie:
> =09=09> I found my two mistakes, plus I fixed the method my Professor s=
aid was
> =09=09> incorrect. Now I just have to be able to find ALL optimal solu=
tions,
> =09=09> instead of just one. Hooray!
> =09=09>
> =09=09> Rachel
--
Ein Unseliger, der nur kreist um sich selbst,
im Leben wird er dem Ruhm nachsehen
und doppelt sterbend untergehen;
im gemeinen Staub, aus dem er entsprungen,
unbeweint, ungeehrt und unbesungen.
[Sir Walter Scott]
-------------------------------------------------------
--=20
Ein Unseliger, der nur kreist um sich selbst,
im Leben wird er dem Ruhm nachsehen
und doppelt sterbend untergehen;
im gemeinen Staub, aus dem er entsprungen,
unbeweint, ungeehrt und unbesungen.
[Sir Walter Scott]