Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add infix:<+&>(Any, Any) (and related bitwise ops).
  • Loading branch information
pmichaud committed Aug 3, 2011
1 parent 0cd9e76 commit 9a99a12
Showing 1 changed file with 26 additions and 21 deletions.
47 changes: 26 additions & 21 deletions src/core/Numeric.pm
Expand Up @@ -150,25 +150,30 @@ multi infix:«>=»(\$a, \$b) { $a.Numeric >= $b.Numeric }

## bitwise operators

proto infix:<+&>(|$) { * }
multi infix:<+&>() { +^0 }
multi infix:<+&>($x) { $x }

proto infix:<+|>(|$) { * }
multi infix:<+|>() { 0 }
multi infix:<+|>($x) { $x }

proto infix:<+^>(|$) { * }
multi infix:<+^>() { 0 }
multi infix:<+^>($x) { $x }

proto infix:«+<»(|$) { * }
multi infix+<»() { fail "No zero-arg meaning for infix:«+<»"; }
multi infix+<»($x) { $x }

proto infix:«+>»(|$) { * }
multi infix+>»() { fail "No zero-arg meaning for infix:«+>»"; }
multi infix+>»($x) { $x }

proto prefix:<+^>(|$) { * }
proto infix:<+&>(|$) { * }
multi infix:<+&>() { +^0 }
multi infix:<+&>($x) { $x }
multi infix:<+&>($x, $y) { $x.Numeric +& $y.Numeric }

proto infix:<+|>(|$) { * }
multi infix:<+|>() { 0 }
multi infix:<+|>($x) { $x }
multi infix:<+|>($x, $y) { $x.Numeric +| $y.Numeric }

proto infix:<+^>(|$) { * }
multi infix:<+^>() { 0 }
multi infix:<+^>($x) { $x }
multi infix:<+^>($x, $y) { $x.Numeric +^ $y.Numeric }

proto infix:«+<»(|$) { * }
multi infix+<»() { fail "No zero-arg meaning for infix:«+<»"; }
multi infix+<»($x) { $x }
multi infix+<»($x,$y) { $x.Numeric +< $y.Numeric }

proto infix:«+>»(|$) { * }
multi infix+>»() { fail "No zero-arg meaning for infix:«+>»"; }
multi infix+>»($x) { $x }
multi infix+>»($x,$y) { $x.Numeric +> $y.Numeric }

proto prefix:<+^>(|$) { * }

0 comments on commit 9a99a12

Please sign in to comment.