Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Semantics of vector operations (Damian)

3 views
Skip to first unread message

Austin Hastings

unread,
Jan 22, 2004, 1:28:42 PM1/22/04
to du...@lighthouse.tamucc.edu, Language List

> -----Original Message-----
> From: Jonathan Scott Duff [mailto:du...@lighthouse.tamucc.edu]
> Sent: Thursday, January 22, 2004 1:16 PM
> To: Austin Hastings
> Cc: Larry Wall; Language List
> Subject: Re: Semantics of vector operations (Damian)
>
>
> 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.

> > And is this
> >
> > > %languageometer.values ?+=? rand;
> >
> > the same as
> >
> > all( %languageometer.values ) += one( rand );
>
> I don't think so. It's like:
>
> $_ += rand for %languageometer.values
>
> perhaps if you had:
>
> $j |= rand for (0..%languageometer.values)
> any(%languageometer.values) += $j;
>
> Though I'm not sure what that would mean.
>
> 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.)

=Austin

Jonathan Scott Duff

unread,
Jan 22, 2004, 1:43:03 PM1/22/04
to Austin Hastings, Language List
On Thu, Jan 22, 2004 at 01:28:42PM -0500, Austin Hastings wrote:
> > From: Jonathan Scott Duff [mailto:du...@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
du...@lighthouse.tamucc.edu

0 new messages