develooper Front page | perl.perl6.language | Postings from April 2005

Re: Hyper operator corner case?

Thread Previous | Thread Next
From:
Thomas Sandlaß
Date:
April 13, 2005 08:38
Subject:
Re: Hyper operator corner case?
Message ID:
425D3CE8.3010103@orthogon.com
Brent 'Dax' Royal-Gordon wrote:
> IIRC, it's f) (1,2,3,4,5) >>+<< (1,2,$identity,$identity,$identity),
> where $identity's value is determined by a table something like this:

In the case of  &infix_circumfix_meta_operator:{'»','«'}:(List,List:&op)
there's no "upgrade"---to use the S03 term.  A simple "apply &op where
the lists overlap and keep the rest of the longer one" suffices.
That is (1,2,3,4,5) >>+<< (1,2) becomes (1+1, 2+2, 3, 4, 5). For
&infix_circumfix_meta_operator:{'»','«'}:(List,Scalar:&op) the upgrade
works by applying the operator with the scalar to all entries:
(1,2,3,4,5) >>+<< 1 becomes (1+1, 2+1, 3+1, 4+1, 5+1).

What I ask myself is wether (1,2,3) »+ 1 should be a syntax error or just
a different form to express the :(List,Scalar:&) case. BTW, I know that
&infix_prefix_meta_operator:{'»'} isn't mentioned in A12.


> I could be wrong, though; I can't find any support for it in the design docs.

Indeed, "upgrade" is a bit fuzzy ;)
-- 
TSa (Thomas Sandlaß)


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