Diverse Demonstrations Improve In-context Compositional Generalization