On Sun, 27 Oct 2002 [EMAIL PROTECTED] wrote:
: : my @attrs =  qw{   name     type  breed   }
: : my Pet @list=qw{
: :                    fido     dog   collie
: :                    fluffy   cat   siamese
: :      } ~~ sub (@x) { map { _ => _ } @attrs x Inf ^, @x }
: :        ~~ sub (@x) { map { { _ , _ , _ } } @x ;
: 
: by the way , ~~ seems to work like unix "|" pipe . 
: 
: in the Apo4 the entry says 
: 
: @a ~~ sub ( @x ) { ... } ---->  &b(@a) 
: 
: will it hande that :
: 
: @a ~~ map {  _  => _  } 
:    ~~ map {  {_,_,_}  }
: 
: where the first *unsupplyed* argument to map 
: is expected to be *list* ?

The purpose of ~~ is first and foremost to return a reasonable boolean
value in boolean context.  The question is whether the one ~~ will
notice the other ~~ operator in one of its arguments and thereby
force that argument into boolean context, just as

    $x ~~ ?foo($^x)

notices the ? and just calls foo() rather than trying to match the
return value of foo(), as it would if you said:

    $x ~~ +foo()
    $x ~~ ~foo()

I think it would be cool if there were a way to pull the arguments out
to the front, because then we really could write in Japanese word order:

    @args wa $*OUT de print yo!

: also , is  here the following  DWIMmery in place 
: 
: sub pairs   ( $x,$y ){ $x => $y } ;
: sub triples ( $x,$y,$z ){ {$x,$y,$z} };   
: @a ~~ &pairs ~~ &triples ; 
: 
: ? 
: 
: so that ~~ will wrap "for" loop around "pairs" and "tripples" , 
: similar to "-n" perl flag ; 

This doesn't make sense to me.  If you're trying to pass the parsed topic list
to them, they should be returning a boolean value.  If you're trying to return
a set of values to be compared against @a, Perl's not going to also pass @a
to your functions.

Larry

Reply via email to