Front page | perl.perl6.language |
Postings from May 2005
Re: reduce metaoperator
Thread Previous
|
Thread Next
From:
David Wheeler
Date:
May 5, 2005 11:40
Subject:
Re: reduce metaoperator
Message ID:
A1DCD5B6-F191-4633-A574-93455C6E8BD9@kineticode.com
On May 5, 2005, at 11:28 , John Williams wrote:
> How does [+] know you mean
>
> reduce &infix:<+>, @array;
>
> instead of
>
> reduce &prefix:<+>, @array;
>
> which is nonsense, but the [+] is in a prefix position.
Because [] applies only to infix operators, as I understand it.
> With the hyper metaoperator, the real operator is always in the place
> where it would normally be parsed. But this metaoperator pulls the
> real
> operator out of its usual pre/in/post position.
Well, if it was in its place, you wouldn't need to reduce it, would you?
> I suppose users will need to know the answer when they start trying to
> write their own metaoperators.
They should write them only for infix operators.
> I can see how to ask for a binary (hence infix) operator, but how
> do I ask
> for a prefix or postfix operator specifically, which +<< and >>+ do?
> Maybe there are Operator::Prefix, etc, roles defined so you can ask
> for
> them?
Ask for them for what?
Regards,
David
Thread Previous
|
Thread Next