Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /home/duff/git/rakudo/src/core [nom *+$ u=]
- ➤ vi operators.pm
- /home/duff/git/rakudo/src/core [nom *+$ u=]
- ➤ git diff
- diff --cc src/core/operators.pm
- index f6a0eec,acffab3..0000000
- --- a/src/core/operators.pm
- +++ b/src/core/operators.pm
- @@@ -90,6 -90,58 +90,57 @@@ sub SEQUENCE($left, $right, :$exclude_e
- ($cmp < 0) ?? { $^x.succ } !! ( $cmp > 0 ?? { $^x.pred } !! { $^x } )
- }
- + my sub sequence_generator($tail) {
- - $tail.munch($tail.elems - 3) if $tail.elems > 3;
- + my $a = $tail[0];
- + my $b = $tail[1];
- + my $c = $tail[2];
- + my $generator;
- + if $tail.grep({ $_ ~~ Numeric}).elems != $tail.elems {
- + # non-numeric
- + if $tail.elems == 1 {
- + $generator = $infinite ?? { $^x.succ } !! succpred($a cmp $endpoint);
- + }
- + else {
- + $generator = succpred($tail[*-2] cmp $tail[*-1]);
- + }
- + }
- + elsif $tail.elems == 3 {
- + my $ab = $b - $a;
- + if $ab == $c - $b {
- + if $ab != 0 || $a ~~ Numeric && $b ~~ Numeric && $c ~~ Numeric {
- + $generator = { $^x + $ab }
- + }
- + else {
- + $generator = succpred($b cmp $c)
- + }
- + }
- + elsif $a != 0 && $b != 0 && $c != 0 {
- + $ab = $b / $a;
- + if $ab == $c / $b {
- + $ab = $ab.Int if $ab ~~ Rat && $ab.denominator == 1;
- + $generator = { $^x * $ab }
- + }
- + }
- + }
- + elsif $tail.elems == 2 {
- + my $ab = $b - $a;
- + if $ab != 0 || $a ~~ Numeric && $b ~~ Numeric {
- + $generator = { $^x + $ab }
- + }
- + else {
- + $generator = succpred($a cmp $b)
- + }
- + }
- + elsif $tail.elems == 1 {
- + $generator = $a cmp $endpoint > 0 ?? { $^x.pred } !! { $^x.succ }
- + }
- + elsif $tail.elems == 0 {
- + $generator = {()}
- + }
- + return $generator;
- + }
- +
- +
- (GATHER({
- /home/duff/git/rakudo/src/core [nom *+$ u=]
- ➤ vi operators.pm
- /home/duff/git/rakudo/src/core [nom *+$ u=]
- ➤ git diff
- diff --cc src/core/operators.pm
- index f6a0eec,acffab3..0000000
- --- a/src/core/operators.pm
- +++ b/src/core/operators.pm
- /home/duff/git/rakudo/src/core [nom *+$ u=]
- ➤ git st
- # On branch nom
- # Unmerged paths:
- # (use "git reset HEAD <file>..." to unstage)
- # (use "git add/rm <file>..." as appropriate to mark resolution)
- #
- # both modified: operators.pm
- #
- # Untracked files:
- # (use "git add <file>..." to include in what will be committed)
- #
- # ../../foo.t
- no changes added to commit (use "git add" and/or "git commit -a")
- /home/duff/git/rakudo/src/core [nom *+$ u=]
- ➤
Add Comment
Please, Sign In to add comment