On 23 July 2010 01:41, Moritz Lenz <mor...@faui2k3.org> wrote: > Use the right tool for the right job: > >> square numbers: 0, 1, 4, 9, 16, 25, 36, etc. > > (1..10).map(* ** 2)
Or even just: (1..10) »**» 2 Note that you can also get most of the effects you want by using @_ in the series' generator block. For example, here are all the square numbers: 0, { @_**2 } ... * and all the factorials: 1, { (@_+1) * @_[*-1] } ... * or all the factorials more prettily but less inefficiently: 1, { [*] 1...@_ } ... * However, those *are* clunky and nigh unreadable, so I certainly wouldn't object to having the index of the next generated element readily available as an explicit variable in a series' generator block. That would make all manner of evil both easier and cleaner. >;-) Damian