Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
without is different from orelse
  • Loading branch information
TimToady committed Aug 8, 2015
1 parent 68c01f4 commit b527b31
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Perl6/Actions.nqp
Expand Up @@ -828,7 +828,7 @@ Compilation unit '$file' contained the following violations:
return;
}
elsif ~$mc<sym> eq 'without' {
make tailthunk_op('&infix:<orelse>',[$mc,$<EXPR>]);
make tailthunk_op('&infix:<notandthen>',[$mc,$<EXPR>]);
return;
}
my $mc_ast := $mc.ast;
Expand Down
14 changes: 13 additions & 1 deletion src/core/operators.pm
Expand Up @@ -579,7 +579,19 @@ sub infix:<andthen>(*@a) {
return Bool::True unless @a;
my Mu $current := @a.shift;
for @a {
return $current unless $current.defined;
return Empty unless $current.defined;
# Have to check Callable till we get tailthunky lists
$current := $_ ~~ Callable
?? (.count ?? $_($current) !! $_())
!! $_;
}
$current;
}
sub infix:<notandthen>(*@a) {
return Bool::True unless @a;
my Mu $current := @a.shift;
for @a {
return Empty if $current.defined;
# Have to check Callable till we get tailthunky lists
$current := $_ ~~ Callable
?? (.count ?? $_($current) !! $_())
Expand Down

0 comments on commit b527b31

Please sign in to comment.