On 5/18/05, Ingo Blechschmidt <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> now that the following works in Pugs :)...
> 
>   sub infix:<.> (Code &x, Code &y) { sub ($z) { x(y($z)) } }
>   (&say . &int)(10/3);    # 3
> 
>   use Set;
>   sub infix:<∈> ($item, @set) {
>     set(@set).includes($item);
>   }
>   "foo" ∈ <bar baz foo>;  # true
>   23    ∈ <bar baz foo>;  # false
> 
> ...we wondered what the default precedence of those user defined infix ops
> should be.

In the absence of a trait specifying otherwise, the precedence
defaults to the same as infix:<+>.

> And how do I explicitly define the precedence?

Using the `tighter`, `looser`, and `equiv` traits.  You specify
precedence in terms of the precedence of other existing ops.

    sub infix:<.>(&f, &g) is looser(&infix:<+>) {...}

Luke

Reply via email to