I\'m trying to write a function in Scheme that takes two strings as input and returns a list of all optimal pairs of strings. In order to do this, I know that I need to make use
I think you have almost everything you need except for a function that can sort a list using a predicate function.
If your Scheme interpreter does not provide a sorting function, you can use one found at Wikibooks . You'll have to adapt it to take a predicate function instead of using <=
as the default predicate function.
Your predicate function can be:
(define (compare-by-alignment lhs rhs)
(<= (alignment-score-tail lhs) (alignment-score-tail rhs)))
You can call merge-sort
using your list and predicate function as:
(merge-sort lst compare-by-alignment)