Larry Wall wrote:
$dot_product = <@vector1,@vector2>;

Is that possible? That would be uber-cool.

More likely just use

    sub infix:<·> (@a,@b) { ... }
    $dot_product = @vector1 · @vector2;


And for Daniel R. and other observers, how about this:

# Courtesy of Larry
sub infix:<·> (@a,@b) { [+] @a »*« @b }

my @vector1 = (1,2,3);
my @vector2 = (2,3,4);
say @vector1 · @vector2;

I think that's really nifty. So you can talk about Hyper operators and then show the dot product. What do you think?


Reply via email to