Learning to grok: Emergence of in-context learning and skill composition in modular arithmetic tasks