Larry Wall <> writes:
> On Fri, Nov 01, 2002 at 11:51:17AM -0700, John Williams wrote:
> > Right. ^= is rather pointless, because = already understands list
> > context.
>
> They're not quite the same because list assignment truncates first. To wit:
>
> @a = [1,2,3];
> @b = [4,5];
>
> @a = @b; # @a gets [4,5]
>
> @a ^= @b; # @a gets [4,5,undef]
>
> And if you define = as an "intersection" rather than a "union" op, you'd get
>
> @a ^= @b; # @a gets [4,5,3]
>
> Maybe. Or there could be a truncation implicit in intersection operators.
>
is it possible to make more clear this entry in the perl6 just-ice :
for loop is just ...
because it seems that all "plaintive wine" flows because that is
unclear .
.... because the second part seems to be obvious :
vector operation is just a "for" loop with arguments "scattered" around (
and inside) it .
something like
sub operator:^[] (Code &op, @a, @b) is parsed /\^\[<op>\]/ { ... }
if we assume that ^[] staff is just a "for" loop ( that is, subroutine
) with one ( for prefix/postfix) or two ( for infix ) input streams (
wich can be degenerate if one of the arguments is scalar ) ( and ^[] is
more general , because it can accept hashes ( maybe we should allow
hash as input stream in "for" loop ) ) so if we assume that,
than probably the decision on union/intersection in vector ops and for
loop with multiple streams should be unifyed .
in for loop we have special "|" , "&" , stream separators to
distinguish/force what we want. why for vector operations this have to
be more implicit ? ( or may be I misunderstood and It is not ) .
in other words , is it going to be that each op will have its own
default behavior ( with respect to unify/intersect and such ) when
vectorized ? can I define an operator and be sure about its behavior
when vectorized , or should I specify it at scalar operator definition
, or should I define explicitely both scalar and vector version.
arcadi