On Thu, Jul 22, 2004 at 02:48:59PM -0600, Luke Palmer wrote: : JOSEPH RYAN writes: : > When I think about your description of xxx, I : > summarized it in my head as "Call a coderef a certain : > number of times, and then collect the results." : > That's pretty much what map is, except that xxx is : > infix and map is prefix. : > : > : > @results = { ... } xxx 100; : > @results = map { ... } 1.. 100; : > : > Doesn't seem that special to me. : : And adding to that the definition of a unary hyper operator: : : [EMAIL PROTECTED] == map { §$_ } @list : : It seems that the rand problem could be solved this way: : : my @nums = rand« (100 xx 100);
The rand function may be a bad example, since it's by nature a generator, and you should maybe have to work harder to get a single value out of it. We haven't really said what <$fh> xx 100 should do, for instance. I guess the real question is whether xx supplies a list context to its left argument (and whether rand pays attention to list context). These might produce very different results: @foo = (rand); @bar = (+rand); On the other hand, history has rand producing a scalar, so arguably we should stick with that. Larry