Re: xx and re-running

2004-07-26 Thread Matthew Walton
Larry Wall wrote: 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

Re: xx and re-running

2004-07-24 Thread Larry Wall
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 :

Re: xx and re-running

2004-07-23 Thread Michele Dondi
On Thu, 22 Jul 2004, JOSEPH RYAN wrote: 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 = {

Re: xx and re-running

2004-07-23 Thread Brent 'Dax' Royal-Gordon
Michele Dondi wrote: Quite similarly, for example, I'd like to have a fold() function like the one that is available in many functional programming languages, a la: my $tot = fold 0, { + }, 1..10; # 55 my $fact = fold 1, { * }, 2..5; # 120 Those blocks would be a syntax error; the

Re: xx and re-running

2004-07-23 Thread Luke Palmer
Michele Dondi writes: Quite similarly, for example, I'd like to have a fold() function like the one that is available in many functional programming languages, a la: my $tot = fold 0, { + }, 1..10; # 55 my $fact = fold 1, { * }, 2..5; # 120 (i.e. please DO NOT point out that there

Re: xx and re-running

2004-07-23 Thread Michele Dondi
On Thu, 22 Jul 2004, Luke Palmer wrote: 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); Huh?!? While not so bad (apart the unicode operator

Re: xx and re-running

2004-07-23 Thread Michele Dondi
On Fri, 23 Jul 2004, Brent 'Dax' Royal-Gordon wrote: Those blocks would be a syntax error; the appropriate way to do that would be to refer to the operator by its proper name: my $tot = fold 0, infix:+, 1..10; Well, I suspected that. The matter is I still know too few concretely

Re: xx and re-running

2004-07-23 Thread Michele Dondi
On Fri, 23 Jul 2004, Luke Palmer wrote: Well, Perl 6 is coming with one of those as a builtin, called Creduce (see List::Util). But you can't quite use a shorthand syntax like yours. You have to say either: Cool, that's what I wanted to know. Taking into account both this circumstance and

xx and re-running

2004-07-22 Thread James Mastros
Recently on perlmonks, at http://perlmonks.org/index.pl?node_id=375255, someone (DWS, actually) brought up the common error of expecting x (in particular, listy x, which is xx in perl6) to not create aliases. What he was doing in particular, I don't have any expectation of making it work, but

Re: xx and re-running

2004-07-22 Thread JOSEPH RYAN
- Original Message - From: James Mastros [EMAIL PROTECTED] Date: Sunday, July 18, 2004 5:03 am Subject: xx and re-running Recently on perlmonks, at http://perlmonks.org/index.pl?node_id=375255, someone (DWS, actually) brought up the common error of expecting x (in particular

Re: xx and re-running

2004-07-22 Thread Luke Palmer
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;