Define convenience function List.replicate.