>If I understand this correctly, then you need to know, if you have an odd 
>number and the even number one higher?

Yes, that's exactly right, Jakob. You have a concise way of stating things :-)

>on CheckCards a1, a2
>   return 2*(a1 mod 2)=a2-a1+1
>end

Thanks, Jakob--you win the grand prize for thinking out of the box (if 
you're familiar with current American slang)!

I'm going to run some speed tests and report back to the list, but at first 
blush your solution looks quite elegant. It would need to be 
well-commented, of course, for future programmers (or for me, in 6 months).

I shall compare the speed of your solution with a combination of the 
answers I got from Colin & Irv. I think yours will be fastest, but I want 
to make sure--the division and multiplication in your solution introduce an 
interesting factor. Division & multiplication, even of integers, is slower 
than boolean comparisons. How much? Enough to make your solution slower? I 
don't know--I'll report back Monday.

>(What you do to please gerbils  ;-)

Umm... not entirely sure of the allusion, but I'm afraid I've never even 
met Richard Gere ;-)


Cordially,
Kerry Thompson
Learning Network


[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to