@mike Thanks for checking & looking into this, interesting . The code for checking this is not very robust (it simply tries Democrats first and Republicans second). As you point out, the right approach would be to check the party membership dates (unless there are presidents who switched parties during presidential terms?) I'll see if I can get that fixed!
I'm Microsoft MVP (formerly C#, now F#) and a PhD student at the University of Cambridge. I wrote a book about functional programming (with Jon Skeet) called Real-world Functional Programming which explains functional concepts and F# and I contributed to the development of F# as an intern and a contractor.
Together with F# architect Phil Trelford, I lead functional programming courses in London and New York. The course is designed for both developers and scientists interested in functional programming style and F#. For more information see Fast Track to F#.