Re: hyp-op examples of a Bag type in S03

2006-05-22 Thread Sam Vilain
Darren Duncan wrote:

 $bag1 - 1; # Bag(2,7,[1,Seq(8,2)],7)
 $bag2 - (1,1,1,1); # probably the same
 $bag3 - (1,1,2,1); # ?
  


Bag's won't .does(Array) or .does(Coll[Seq,...]), so that hyperoperator
won't work - if anything it would try to add the (1,1,1,1) list to all
of the elements of the bag. You'd need to put the bag in something that
does imply ordering first.

This applies to any unordered collection, bags or sets.

Sam.


Re: hyp-op examples of a Bag type in S03

2006-05-22 Thread Darren Duncan

At 4:11 PM +1200 5/23/06, Sam Vilain wrote:

Darren Duncan wrote:


 $bag1 - 1; # Bag(2,7,[1,Seq(8,2)],7)
 $bag2 - (1,1,1,1); # probably the same

  $bag3 - (1,1,2,1); # ?

Bag's won't .does(Array) or .does(Coll[Seq,...]), so that hyperoperator
won't work - if anything it would try to add the (1,1,1,1) list to all
of the elements of the bag. You'd need to put the bag in something that
does imply ordering first.
This applies to any unordered collection, bags or sets.
Sam.


Yes, I already assumed that only the first line would absolutely 
work, and that the third absolutely wouldn't.


The second line example I considered borderline, because all of the 
elements were the same, and the count of elements matched the count 
in $bag2, so the result is the same no matter which set element each 
is matched up with.  But of course it would be unreasonable for a 
generic Perl 6 implementation to be expected to intuit such things, 
so I shouldn't have said probably the same, if that's specifically 
what you were replying to.


See list post [svn:perl6-synopsis] r9304 - doc/trunk/design/syn, 
where Larry corrected S03 in response to my post.  Case closed.


-- Darren Duncan


Re: hyp-op examples of a Bag type in S03

2006-05-19 Thread Darren Duncan

Er, I meant to say subtracted where I said added. -- Darren Duncan