Front page | perl.perl6.language | Postings from January 2004

## Re: Semantics of vector operations (Damian)

From:
Jonathan Scott Duff
Date:
January 22, 2004 16:08
Subject:
Re: Semantics of vector operations (Damian)
Message ID:
20040122184303.GD17679@lighthouse.tamucc.edu
```On Thu, Jan 22, 2004 at 01:28:42PM -0500, Austin Hastings wrote:
> > From: Jonathan Scott Duff [mailto:duff@lighthouse.tamucc.edu]
> > 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?
> >
> > 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.
>
> It would be disappointing if junctions could not be lvalues.

Oh, I think that junctions can be lvalues but a junction is different
from the things that compose it.  I.e.,

\$a = 5; \$b = 10;
\$c = \$a | \$b;
\$c += 5;

print "\$a \$b\n";
if \$c > 10 { print "More than 10!\n"; }

would output

5 10
More than 10!

because the *junction* has the +5 attached to it rather than the
individual elements of the junction.  Read the if statement as "if any
of (5 or 10) + 5 is greater than 10, ..."  Which is the same as "if
any of 10 or 15 is greater than 10, ..."

I hope I'm making sense.

> > I don't think junctions apply at all in vectorization.   They seem to
> > be completely orthogonal.
>
> I'm curious if that's true, of if they're two different ways of getting to
> the same data. (At least in the one-dimension case.)

I'm just waiting for Damian to speak up :-)

-Scott
--
Jonathan Scott Duff
duff@lighthouse.tamucc.edu

```