A Domain-General Theory of the Development of Perceptual Discrimination