"... I suppose the clean way to do this would be to define a cartesian product of two factors with the induced lexicographic order (is there a standard function for doing this?):" Of course. ?interaction. -- Bert Gunter Genentch