(thanks to Michael Adams and Kent Dybvig for making the code available in its entirety in their ICFP 2008 paper)