Luke Palmer wrote:

Larry Wall writes:


Certainly. The zone markers are as orthogonal to sigils as we can
make 'em. Though I'm not sure we've given a meaning to *&foo yet.
I suppose that would have to mean that the next slurpy parameter has
to be a sub ref.



Uhmm... isn't *&foo the adverbial block? That is, isn't it where grep gets its code block in:

   @list.grep:{ $_ % 2 }



In S29, I currently have C<grep> as:

multi sub grep (Any|Junction $test : [EMAIL PROTECTED]) returns List {
  gather {
    for @values -> $x {
      take $x if $x ~~ $test;
    }
  }
}


If you wish to supply a closure for C<$test>, you're free to do so.


If I were building it to accept just a closure, I would think:

  multi sub grep (Code &test : [EMAIL PROTECTED])

or

  multi sub grep (: Code +&test = &defaulttest ,  [EMAIL PROTECTED])


would make more sense than:

  multi sub grep (: Code *&test, [EMAIL PROTECTED])


At least to me it does. If you see some advantage to that way, please inform me of it. It might change C<map> away from:


multi sub map (Code $expression : [EMAIL PROTECTED]) returns List {
  gather {
    while @values {
      take $expression
         .( splice(@values, 0, $expression.arity) );
    }
  }
}


-- Rod Adams





Reply via email to