Skip to content

Commit

Permalink
Add Int versions of infix:«==», infix:«!=», and infix:«<» which go di…
Browse files Browse the repository at this point in the history
…rectly into PIR.
  • Loading branch information
colomon committed Jul 28, 2010
1 parent 7f5c22f commit 2808a52
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/core/Int.pm
Expand Up @@ -31,6 +31,21 @@ augment class Int does Real {
}
}

multi sub infix==»(Int $a, Int $b) {
pir::iseq__III( $a, $b) ?? True !! False
}

multi sub infix!=»(Int $a, Int $b) {
pir::iseq__III( $a, $b) ?? False !! True # note reversed
}

multi sub infix<»(Int $a, Int $b) {
pir::islt__III( $a, $b) ?? True !! False
}

# Should pull along the other Int comparison operators at some point,
# but this is a great start.

our multi sub prefix:<->(Int $a) {
upgrade_to_num_if_needed(pir::neg__NN($a))
}
Expand Down

0 comments on commit 2808a52

Please sign in to comment.