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

Default precedence level of user defined infix ops

Thread Next
From:
Ingo Blechschmidt
Date:
May 18, 2005 07:49
Subject:
Default precedence level of user defined infix ops
Message ID:
loom.20050518T163123-806@post.gmane.org
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. 
 
And how do I explicitly define the precedence? 
 
 
--Ingo 
 
--  
Linux, the choice of a GNU | Mathematicians practice absolute freedom. 
generation on a dual AMD   | -- Henry Adams   
Athlon!                    | 


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