TIMTOWT concat / hypo-operators

2001-10-06 Thread Edwin Steiner


Hello!

Is this going to concat $a,$b and $c?

$foo = _($a,$b,$c);

(One way to save underlines and spaces.)
Or would that be:

$foo = _@($a,$b,$c);

BTW: what will these do?

$a _=_ ($b,$c);

$a ^_= ($b,$c);  # (better with hypo-operator?, see below)

(WIM in Perl 5: $a .= $b.$c ?)

Could there also be *hypo*-operators, i.e. operators which try to
*lower* (reduce) the dimensionality of their operands to the lowest
common dim. So

$foo = 5 +^ (1,2);

would set $foo to (5 + 1) + 2 and

$foo = $a _^ ($b,$c);
$a _=^ ($b,$c);

would do the same concats as above respectively?
Another application:

$sum = 0 +^ @values;

Granted: ^ is not the best choice for a meta-operator which lowers
something. :)

-Edwin




RE: TIMTOWT concat / hypo-operators

2001-10-06 Thread Brent Dax

Edwin Steiner:
# Is this going to concat $a,$b and $c?
#
#   $foo = _($a,$b,$c);
#
# (One way to save underlines and spaces.)
# Or would that be:
#
#   $foo = _@($a,$b,$c);

That would be C$foo=join('', $a, $b, $c), just like in Perl 5.

# BTW: what will these do?
#
#   $a _=_ ($b,$c);

That's concatenating a stringified list ($b, $c) to $a.  (Unary _ is the
stringification operator.)

#   $a ^_= ($b,$c);  # (better with hypo-operator?, see below)
#
# (WIM in Perl 5: $a .= $b.$c ?)

No, that'll be the same as C$a _= $c, since $a creates a scalar
context.

# Could there also be *hypo*-operators, i.e. operators which try to
# *lower* (reduce) the dimensionality of their operands to the lowest
# common dim. So
#
#   $foo = 5 +^ (1,2);
#
# would set $foo to (5 + 1) + 2 and
#
#   $foo = $a _^ ($b,$c);
#   $a _=^ ($b,$c);
#
# would do the same concats as above respectively?
# Another application:
#
#   $sum = 0 +^ @values;
#
# Granted: ^ is not the best choice for a meta-operator which lowers
# something. :)

I don't really see the use of hypo-operators.

Note that everything I said here is subject to overriding by someone who
knows more than me.  :^)

--Brent Dax
[EMAIL PROTECTED]
Configure pumpking for Perl 6

They *will* pay for what they've done.