Skip to content

Commit

Permalink
Make put/print "a",any(<b c d>) work
Browse files Browse the repository at this point in the history
- we already had a candidate for handling a Junction, but not if part of a List
- simplified the code to let List.join do the hard work
  - which automatically takes care of the Junction issue
  • Loading branch information
lizmat committed Dec 14, 2017
1 parent eaf609e commit 3405001
Showing 1 changed file with 5 additions and 20 deletions.
25 changes: 5 additions & 20 deletions src/core/io_operators.pm
Expand Up @@ -2,20 +2,10 @@ my class IO::ArgFiles { ... }

proto sub print(|) {*}
multi sub print(--> True) { } # nothing to do
multi sub print(Junction:D \j) {
j.THREAD(&print)
}
multi sub print(Str:D \x) {
$*OUT.print(x);
}
multi sub print(\x) {
$*OUT.print(x.Str);
}
multi sub print(**@args is raw) {
my str $str;
$str = nqp::concat($str,nqp::unbox_s(.Str)) for @args;
$*OUT.print($str);
}
multi sub print(Junction:D \j) { j.THREAD(&print) }
multi sub print(Str:D \x) { $*OUT.print(x) }
multi sub print(\x) { $*OUT.print(x.Str) }
multi sub print(**@args is raw) { $*OUT.print: @args.join }

proto sub say(|) {*}
multi sub say() { $*OUT.print-nl }
Expand Down Expand Up @@ -54,13 +44,8 @@ multi sub put(\x) {
$out.print(nqp::concat(nqp::unbox_s(x.Str),$out.nl-out));
}
multi sub put(**@args is raw) {
my str $str;
my $iter := @args.iterator;
nqp::until(
nqp::eqaddr(($_ := $iter.pull-one), IterationEnd),
$str = nqp::concat($str, nqp::unbox_s(.Str)));
my $out := $*OUT;
$out.print(nqp::concat($str,$out.nl-out));
$out.print: @args.join ~ $out.nl-out
}

proto sub note(|) {*}
Expand Down

0 comments on commit 3405001

Please sign in to comment.