@edvin: A notable difference between my implementation and (0..4).map, if I'm not mistaken, is that my solution sets the right capacity for the list from the start, whereas the range uses 10 by default. So, for very large sizes, it avoids reallocating and copying arrays.