Jonathan Scott Duff writes:
> On Thu, Jan 22, 2004 at 01:10:23PM -0500, Austin Hastings wrote:
> > In reverse order:
> > 
> > >     %languageometer.values Â+= rand;
> > 
> > This is the same as
> > 
> >      all( %languageometer.values ) += rand;
> > 
> > right?

Well, yes.  It's also the same as each of:

    any(  %languageometer.values ) += rand;
    none( %languageometer.values ) += rand;
    one(  %languageometer.values ) += rand;

Since the junctions aren't yet being evaluated in boolean context, the
type of the junction doesn't matter.  Which is why making junctions
applicable lvalues might be a bad idea.  I'm not sure, but this looks
like a potential confuser.

> It's the same as 
> 
>       $r = rand;
>       $_ += $r for %languageometer.values
> 
> Your junction looks like it should work but I think you're really
> adding the random number to the junction, not the elements that compose
> the junction thus none of %languageometer.values are modified.

Hmm... that depends on whether junctions hold references, or what they
do in lvalue context, and a whole bunch of other, undecided things.

> > And is this
> > 
> > >     %languageometer.values Â+=Â rand;
> > 
> > the same as
> > 
> >     all( %languageometer.values ) += one( rand );

No, what you just wrote is the same as:

    all( %languageometer.values ) += rand;

> I don't think so.  It's like:
> 
>       $_ += rand for %languageometer.values

Sortof.  I think Larry was implying that rand returned an infinite list
of random numbers in list context.  If not, then what he said was wrong,
because it would be sick to say that:

    (1,2,3,4,5) Â+Â foo()

Calls foo() 5 times.

> perhaps if you had:
> 
>       $j |= rand for (0..%languageometer.values)
>       any(%languageometer.values) += $j;
> 
> Though I'm not sure what that would mean.  

Nonononono! Don't do that!  That adds *each* of the random numbers to
*each* of the values.  That is, each of the values would increase by
approximately %languageometer/2.

> I don't think junctions apply at all in vectorization.   They seem to
> be completely orthogonal.

I'd be happy if that were the case.

Luke
Ã

Reply via email to