Re: Autothreading generalization

2005-02-01 Thread Markus Laire
Luke Palmer writes:
Craig DeForest writes:
Yeah, the sigils do get in the way for small placeholder variables like
these.
 @C[ $i; $j; $k; $l ] = @A[ $i; $j ] * @B[ $k; $l ] Â
Losing the carets doesn't do much for us (and would force us to use the
explicit syntax, whatever that might be).  Hmm, on the other hand, ^
doesn't mean anything in term context yet.  I feel uncomfortable about
allowing ^ as a shorthand for $^, since every other variable in the
whole damn language has one of the four standard sigils.
What about adding fifth sigil into the language? To be used only with 
placeholder-variables?

That way ^ (or whatever char we choose) wouldn't be shorthand for $^, 
but part of the actual variable name, as are other sigils. That char 
should be selected based on it's readibility in expressions like these.

Would placeholder variables be used often enough to varrant their own sigil?
Luke
--
Markus Laire



[OT] post-structuralist object oriented system

2005-02-01 Thread PA
For your entertainment:
"Lua’s Story of O"
http://alt.textdrive.com/lua/19/lua-story-of-o
Cheers
--
PA, Onnay Equitursay
http://alt.textdrive.com/


Re: Autothreading generalization

2005-02-01 Thread Craig DeForest
On Tuesday 01 February 2005 01:18 am, Markus Laire wrote:
> Luke Palmer writes:
> > Yeah, the sigils do get in the way for small placeholder variables like
> > these:
> > Â @C[ $i; $j; $k; $l ] = @A[ $i; $j ] * @B[ $k; $l ] Â
>...
> Would placeholder variables be used often enough to varrant their own
> sigil?

Can't say for sure.  This style of explicit threading was tried in PDL but 
turned out to not be as important as robust implicit threading, and the 
explicit threading (handled by block-scoped "thread variables" that you would 
declare before using them) never got robust enough to be considered a 
production feature.

The current threading engine in PDL uses positional dimension slots to work 
out what is what:  active dimensions have to be at the start of the dimension 
list, and thread dimensions have to be at the end.   In principle, this is a 
Bad Thing since you sometimes have to transpose arrays just to get the dims 
in the right slots; but it turns out to be a Good Thing: it is  the right 
optimization for nearly all of the expressions that ever get written.

For example, with PDL-style threading, Luke's expression (written by someone 
paranoid) would be:
$c = $a(:,:,*1,*1) * $b(*1,*1,:,:);  # perl5/PDL 4-D outer product
where the names have been replaced by dimensional positions.
That still turns out to be more concise than the named version.

Most of the threading ops I do in PDL turn out to have zero active dimensions 
(scalar op, being looped over).  A few of them are vector ops (e.g. lookup 
into a table), and a lot are just matrix multiplication.  I have only had a 
few opportunities to use 5-D constructs (e.g. a collection of i x j image 
tiles that are themselves arrayed in an n x m matrix, with 3 colors).  I 
suspect that these sorts of higher dimensional operations will turn out to be 
ignored by virtually everyone -- but that they will turn out to be devilishly 
useful for a handful of brilliant people.