[Tutor] comparing seqs by successive intervals

don arnold darnold02 at sprynet.com
Mon Jan 19 07:00:54 EST 2004


----- Original Message -----
From: "kevin parks" <kp8 at mac.com>
To: "don arnold" <darnold02 at sprynet.com>
Sent: Monday, January 19, 2004 1:11 AM
Subject: Re: [Tutor] comparing seqs by successive intervals


> Don,
>
> This is awesome. Very helpful indeed. I am taking a good look at it
>
> So interval() measures the intervals between each successive list
> element and store those measurements in a list the -1 is needed
> that we don't overrun the list right?

Yes. We're calculating each interval measurement by examining the current
element and the one after it. Since there isn't an element after the last
one (not too surprising), we want to stop at the second to the last element.

>
> With IsEqual() you start by taking the input lists and getting the
> interval sequences
> by calling the function interval() and then you use min to make sure we
> compare only the number of elements we have in common
> to both lists and just snub the list elements that are more than min?

Exactly.

> Then the if loop part is the actual comparison...

It isn't a loop. But otherwise correct.

>
> I hope i am understanding this right.... I am going to print this out
> and examine
> it with a red pen.

I'd say you're understanding it perfectly.

>
> Don, thanks for your help. I was really lost on how to change the list
> into a new list which
> was the sequence of intervals. I am not sure i would have gotten that
> part on my own.
>   as the  len(seq)-1, and seq[i+1] - seq[i] parts were eluding me.
>
> I appreciate your taking the time and effort to reply.
>
> -kevin--

No problem. We're here to help.

Don

<snip rest>




More information about the Tutor mailing list