Skip to content

Commit

Permalink
Merge branch 'master' of git@github.com:rakudo/rakudo
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Apr 29, 2010
2 parents 9d927ac + c4857ab commit 6e91b9b
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 26 deletions.
2 changes: 1 addition & 1 deletion docs/ROADMAP
Expand Up @@ -35,7 +35,7 @@ Really important items
1 *** get the Advent examples running again (all)

Ought to have items
2 ** basic Buf implementation (A)
2 ** basic Buf implementation (A, masak)
2 ** speed issues and profiling (C, all)
2 ** regex modifiers (B, pmichaud)
2 *** installation standards (A)
Expand Down
8 changes: 7 additions & 1 deletion src/Perl6/Grammar.pm
Expand Up @@ -1298,7 +1298,13 @@ token quote:sym<Q> { 'Q' <![(]> <.ws> <quote_EXPR> }
token quote:sym<Q:PIR> { 'Q:PIR' <.ws> <quote_EXPR> }
token quote:sym</null/> { '/' \s* '/' <.panic: "Null regex not allowed"> }
token quote:sym</ /> { '/'<p6regex=.LANG('Regex','nibbler')>'/' <.old_rx_mods>? }
token quote:sym<rx> { <sym> >> '/'<p6regex=.LANG('Regex','nibbler')>'/' <.old_rx_mods>? }
token quote:sym<rx> {
<sym> >>
[
| '/'<p6regex=.LANG('Regex','nibbler')>'/' <.old_rx_mods>?
| '{'<p6regex=.LANG('Regex','nibbler')>'}' <.old_rx_mods>?
]
}
token quote:sym<m> {
<sym> >>
[
Expand Down
6 changes: 6 additions & 0 deletions src/builtins/assign.pir
Expand Up @@ -85,6 +85,12 @@ src/builtins/assign.pir - assignment operations
$P0 = find_lex '$opname'
$S0 = $P0
$P0 = get_global $S0
$P1 = a.'defined'()
if $P1 goto defined
$P2 = $P0()
$P1 = $P0($P2, b)
.tailcall '&infix:<=>'(a, $P1)
defined:
$P1 = $P0(a, b)
.tailcall '&infix:<=>'(a, $P1)
.end
Expand Down
4 changes: 4 additions & 0 deletions src/core/Any-list.pm
Expand Up @@ -6,6 +6,10 @@ augment class Any {
pir::join__SsP($separator, self.list.eager);
}

multi method elems() {
1;
}

our multi method map(&block) {
Q:PIR {
.local pmc self, block, map
Expand Down
20 changes: 10 additions & 10 deletions src/core/Complex.pm
Expand Up @@ -255,11 +255,11 @@ multi sub infix:<+>(Complex $a, Complex $b) {
Complex.new($a.re + $b.re, $a.im + $b.im);
}

multi sub infix:<+>(Complex $a, $b) {
multi sub infix:<+>(Complex $a, Real $b) {
Complex.new($a.re + $b, $a.im);
}

multi sub infix:<+>($a, Complex $b) {
multi sub infix:<+>(Real $a, Complex $b) {
# Was $b + $a; but that trips a ng bug, and also means
# that Num + Complex is slower than Complex + Num, which
# seems daft.
Expand All @@ -274,23 +274,23 @@ multi sub infix:<->(Complex $a, Complex $b) {
Complex.new($a.re - $b.re, $a.im - $b.im);
}

multi sub infix:<->(Complex $a, $b) {
multi sub infix:<->(Complex $a, Real $b) {
Complex.new($a.re - $b, $a.im);
}

multi sub infix:<->($a, Complex $b) {
multi sub infix:<->(Real $a, Complex $b) {
Complex.new($a - $b.re, -$b.im);
}

multi sub infix:<*>(Complex $a, Complex $b) {
Complex.new($a.re * $b.re - $a.im * $b.im, $a.im * $b.re + $a.re * $b.im);
}

multi sub infix:<*>(Complex $a, $b) {
multi sub infix:<*>(Complex $a, Real $b) {
Complex.new($a.re * $b, $a.im * $b);
}

multi sub infix:<*>($a, Complex $b) {
multi sub infix:<*>(Real $a, Complex $b) {
Complex.new($a * $b.re, $a * $b.im);
}

Expand All @@ -300,11 +300,11 @@ multi sub infix:</>(Complex $a, Complex $b) {
($a.im * $b.re - $a.re * $b.im) / $d);
}

multi sub infix:</>(Complex $a, $b) {
multi sub infix:</>(Complex $a, Real $b) {
Complex.new($a.re / $b, $a.im / $b);
}

multi sub infix:</>($a, Complex $b) {
multi sub infix:</>(Real $a, Complex $b) {
Complex.new($a, 0) / $b;
}

Expand All @@ -324,11 +324,11 @@ multi sub infix:<**>(Complex $a, Complex $b) {
($a.log * $b).exp;
}

multi sub infix:<**>(Complex $a, $b) {
multi sub infix:<**>(Complex $a, Real $b) {
($a.log * $b).exp;
}

multi sub infix:<**>($a, Complex $b) {
multi sub infix:<**>(Real $a, Complex $b) {
($a.log * $b).exp;
}

Expand Down
10 changes: 8 additions & 2 deletions src/core/Cool-str.pm
Expand Up @@ -42,7 +42,12 @@ augment class Cool {
my $c = 0;
my $l = $limit ~~ ::Whatever ?? Inf !! $limit;
gather while $l > 0 && (my $m = self.match($matcher, :c($c))) {
take $match ?? $m !! ~$m;
if $match {
my $m-clone = $m;
take $m-clone;
} else {
take ~$m;
}
$c = $m.to == $c ?? $c + 1 !! $m.to;
--$l;
}
Expand Down Expand Up @@ -72,7 +77,8 @@ augment class Cool {
gather {
while $l-- > 0 && (my $m = self.match($matcher, :c($c))) {
take self.substr($c, $m.from - $c);
take $m if $all;
my $m-clone = $m;
take $m-clone if $all;
$c = $m.to == $c ?? $c + 1 !! $m.to;
}
take self.substr($c);
Expand Down
14 changes: 11 additions & 3 deletions src/core/Real.pm
Expand Up @@ -10,12 +10,12 @@ role Real does Numeric {
}

# Hmmm... should the second argument be Numeric for the next two?
method exp(Real $exponent: Real $base = e) {
method exp(Real $exponent: Numeric $base = e) {
$base ** $exponent;
}

method log(Real $x: Real $base = e) {
$x.Bridge.log($base.Bridge);
method log(Real $x: Numeric $base = e) {
$x.Bridge.log($base);
}

method sign(Real $x:) {
Expand Down Expand Up @@ -98,6 +98,14 @@ multi sub infix:<->(Num $a, Num $b) {
pir::sub__NNN($a, $b)
}

multi sub infix:<*>(Real $a, Real $b) {
$a.Bridge * $b.Bridge;
}

multi sub infix:<*>(Num $a, Num $b) {
pir::mul__NNN($a, $b)
}

multi sub infix:</>(Real $a, Real $b) {
$a.Bridge / $b.Bridge;
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/metaops.pm
Expand Up @@ -179,7 +179,7 @@ our multi sub infix:<*>() { 1 }
our multi sub infix:<+&>() { +^0 }
our multi sub infix:<+>() { 0 }
our multi sub infix:<->() { 0 }
#our multi sub infix:<~>() { '' }
our multi sub infix:<~>() { '' }
our multi sub infix:<+|>() { 0 }
our multi sub infix:<+^>() { 0 }
our multi sub infix:<~|>() { '' }
Expand Down Expand Up @@ -209,7 +209,7 @@ our multi sub infix:<eqv>() { Bool::True }
our multi sub infix:<||>() { Bool::False }
our multi sub infix:<or>() { Bool::False }
#our multi sub infix:<^^>() { Bool::False }
#our multi sub infix:<//>() { Any }
our multi sub infix:<//>() { Any }
#our multi sub infix:<min>() { +Inf }
#our multi sub infix:<max>() { -Inf }
#our multi sub infix:<=>() { Nil }
Expand Down
10 changes: 5 additions & 5 deletions src/core/operators.pm
Expand Up @@ -34,27 +34,27 @@ our multi sub prefix:<->($a) {
}

our multi sub infix:<+>($a, $b) {
pir::add__NNN($a, $b)
+$a + +$b;
}

our multi sub infix:<->($a, $b) {
pir::sub__NNN($a, $b)
+$a - +$b;
}

our multi sub infix:<*>($a, $b) {
pir::mul__NNN($a, $b)
+$a * +$b;
}

our multi sub infix:</>($a, $b) {
pir::div__NNN($a, $b)
+$a / +$b;
}

our multi sub infix:<%>($a, $b) {
pir::mod__NNN($a, $b)
}

our multi sub infix:<**>($a, $b) {
pir::pow__NNN($a, $b)
(+$a) ** +$b; # parenthesis needed because of precendence.
}

our multi sub infix:<&>(*@items) {
Expand Down
4 changes: 2 additions & 2 deletions tools/contributors.pl
Expand Up @@ -21,7 +21,7 @@
while ($msg =~ /([^\s()]+)\+\+/g) {
$contrib{nick_to_name($1)}++;
}
while ($msg =~ /(couretsy by:?)\s*(\S.*)/i) {
while ($msg =~ /(courtesy by:?)\s*(\S.*)/i) {
$contrib{nick_to_name($1)}++;
}
}
Expand Down Expand Up @@ -67,7 +67,7 @@ sub nick_to_name_from_CREDITS {
}
}
close $f;
use Data::Dumper; print Dumper \%nicks;
use Data::Dumper; $Data::Dumper::Sortkeys = 1; print Dumper \%nicks;
return \%nicks;
}

Expand Down

0 comments on commit 6e91b9b

Please sign in to comment.