On Thu, Jan 22, 2004 at 02:28:09PM -0700, Luke Palmer wrote:
: Well, for being called "vector operators", they're ending up pretty
: useless as far as working with mathematical vectors.

Which is why I suggested calling them distributors or some such.

: As a
: mathematician, I'd want:
: 
:     @vec1 Â*Â @vec2
: 
: To do an inner or an outer product (probably outer, as it has no
: implicit connotations of the + operator).  That is, it would come out
: either a matrix or a scalar.
: 
: But there are other times when I'd want that to call the operator
: respectively.  Then you get this for the inner product:
: 
:     sum(@vec1 Â*Â @vec2)
: 
: Which isn't so bad, after all.

Yes, and I think we have to stick with the naive view of what Â*Â would
do, since there are times you simply want to do a bunch of multiplications
in parallel.

: Hmm, but if it does give an outer product, then a generic tensor product
: is as easy as:
: 
:     reduce { $^a Â+Â $^b } @A Â*Â @B
: 
: And nobody can fathom how happy that would make me.

I'd think it would make you even happier to just use the appropriate
Unicode operators directly (presuming there are such).

: Also, you'd get the nice consistency that:
: 
:     @A Â+Â @B
: 
: Is the same as both:
: 
:     map { @A Â+ $^b } @B
:     map { $^a +Â @B } @A
: 
: Which is undoubtedly what the mathematician would expect  (It's very
: reminiscent of how junctions currently work).
: 
: But then there's the problem of how you express the oft-wanted:
: 
:     map -> $i { @A[$i] + @B[$i] } 0..^min([EMAIL PROTECTED], [EMAIL PROTECTED])
: 
: (Hopefully when @A and @B are of equal length).

Yes, though in fact ÂÂ is supposed to do max() rather than min() here.
Which, in the case of arrays of equal length, comes out to the same
thing...

: Maybe there's a way to do it so that we can both be happy: one syntax
: that does one thing, another that does the other.  Like:
: 
:     @A Â+Â @B           # One-at-a-time
:     @A Â+Â @B           # Outer product
: 
: Or something.  Hmm, then both:
: 
:     @A Â+ $b
:     @A Â+ $b
: 
: Would mean the same thing. 

Which says to me that outer product really wants to be something like
X or â or even â (shades of APL).  In the for-what-it's-worth department,
it looks like Python might be using @ for that.

Larry

Reply via email to