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

Re: TIMTOWT concat / hypo-operators

Thread Previous | Thread Next
From:
Edwin Steiner
Date:
October 7, 2001 03:34
Subject:
Re: TIMTOWT concat / hypo-operators
Message ID:
d73zspso.fsf@gmx.net
jh_lists@fastmail.fm (Jeremy Howard) writes:
> Brent Dax wrote:
> > Edwin Steiner:
> > # 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
[snip]
> > I don't really see the use of hypo-operators.
> >
> Well, it's pretty handy to be able to generalise what join() does for concat
> to any abitrary function. It's covered by:
>   http://dev.perl.org/rfc/76.html
> which proposes a new reduce() builtin.

I'd like hypo-operators
	a) for the sake of symmetry (imperfect symmetry that is)
	b) because they minimize the separation of verb and object
		cf. $acc += $_ for (@values);
		vs. $acc +=^ @values;
	   (Well, that's not a hell of an argument, is it? :)
	   You could of course do more clever and confusing things
	   with multi-dim. arrays.

Anyway, I realize the need is less than urgent. :)

Maybe Perl 6 is going to be the language to resolve such
"I want it"/"I don't care"-arguments in a friendly way. It should be
feasible to write a module so you can do
	{
	    use Operators::Hypo;
	    @score +=^ (4,1) *^ @points;
	}
lexically, I mean.
What's needed is a parser hook for the operators (which is needed
anyway) and a way to write an extension module which provides
dynamically installable Perl ops which are (almost) as fast as the
builtins (which seems to be in planning).

-Edwin


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