This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| method !run-with-progress ($items, Routine $sub, Str $msg = q{ done}) { | |
| my $prog = Term::ProgressBar.new( :count( $items.elems ), :p ) | |
| if $!verbose; | |
| my $i = 1; | |
| my $supply = $items.Supply.throttle( | |
| $!threads, | |
| -> $item { | |
| say "$i = $item in {$*THREAD.id}"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| method !run-with-progress ($items, Routine $sub, Str $msg = q{ done}) { | |
| my $prog = Term::ProgressBar.new( :count( $items.elems ), :p ) | |
| if $!verbose; | |
| my $i = 1; | |
| $items.hyper( :batch($!threads) ).map( | |
| sub ($item) { | |
| say $item;return; | |
| $sub($item); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| method !run-with-progress ($items, Routine $sub, Str $msg = q{ done}) { | |
| my $prog = Term::ProgressBar.new( :count( $items.elems ), :p ) | |
| if $!verbose; | |
| my $supply = $items.Supply; | |
| if $!threads > 1 { | |
| my $sched = ThreadPoolScheduler.new( :max_threads($!threads) ); | |
| $supply = $supply.schedule-on($sched); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env perl6 | |
| use v6; | |
| sub MAIN { | |
| my $supply = (1, 2, 3, 4, 5).Supply; | |
| my $sched = ThreadPoolScheduler.new( | |
| :initial_threads(4), | |
| :max_threads(8), | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| my $sched = ThreadPoolScheduler | |
| .new( :max_threads($!threads) ); | |
| my $supply = $items.values.Supply; | |
| $supply.schedule-on($sched); | |
| my $i = 1; | |
| $supply.tap( | |
| sub ($item) { | |
| $sub($item); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use v6; | |
| use File::Temp; | |
| (1..100).hyper(:batch(1)).map( { tempfile() } ); | |
| # Use of Nil in string context in block at /home/autarch/.rakudobrew/moar-nom/install/share/perl6/site/lib/File/Temp.pm:15 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| =begin pod | |
| =defn Item | |
| Definition | |
| =end pod | |
| dd $=pod; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| role R { | |
| multi method foo (Any $foo) { ... } | |
| } | |
| class C does R { | |
| multi method foo (Any $foo) { say $foo } | |
| } | |
| C.new.foo(42) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sub heading (Pod::Heading $node) { | |
| my $tag = 'h' . $node.level; | |
| $!html .= "<$tag>"; | |
| yield; | |
| $!thml .= "</tag>"; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use v6; | |
| use Text::CSV; | |
| sub MAIN ( IO() :$in, IO() :$out ) { | |
| my $csv_in = Text::CSV.new; | |
| my $csv_out = Text::CSV.new( :eol("\r\n") ); | |
| my $in_fh = $in.open(:r); | |
| my $out_fh = $out.open(:w); |