looks like a genetic algorithm, i've programmed years ago. :) i need the sourcecode to solve the problem. it seems that you "zip" the two strings together: unzip $ zip "abcde" "123" -> unzip [('a','1'),('b','2'),('c','3')] -> ("abc","123") i've no idea why you got "saaturn". - marc Am Dienstag, 25. März 2003 01:32 schrieb Weix, Rachel Lynn:
Hi,
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 "-") = -1; else 1 for every pair (see below for what a pair is)
An example set of sequences with an alignment of -3 is as follows:
sc-h-e-me icecream-
(s,i) are a pair, (c, c), etc.
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!
Rachel
-- Each word/sequence you see has been predefined in my Haskell code -- This first example appears to work just fine
Main> printSeq icecream scheme
("icecream", "scheme--")
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")
Main> printSeq mad snowball
("mad", "sno")