develooper Front page | perl.perl6.language | Postings from October 2001

RE: TIMTOWT concat / hypo-operators

Thread Previous | Thread Next
From:
Brent Dax
Date:
October 6, 2001 14:25
Subject:
RE: TIMTOWT concat / hypo-operators
Message ID:
FJELLKOPEAGHOOODKEDPEEKLCHAA.brentdax@cpan.org
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
brentdax@cpan.org
Configure pumpking for Perl 6

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


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About