Moritz Lenz wrote:
Dave Whipp wrote:
[cut] Contrast with Rat which has both separate accessors and the "nude" method (a name that could possibly be improved to avoid adult-content filters)

suggestions welcome.

Attempting to generalize: what we want is an operator that extracts a Seq of values from an object based on a positive criteria. For string objects, this description matches the C<comb> method. Generalizing:

  my @words = $line.comb( /\S+/ );
  my ($num, $denom) = $num.comb( :Ratio );
  my ($mag, $phase) = $z.comb( :Complex::Polar );
  my ($re, $im) = $z.comb( :Complex::Cartesian );
  my ($x, $y) = $vector.comb( [1,0], [0,1] );

Reply via email to