use a function factory for comparisons of Period objects