Created this test file
use v6;
use Test;
use-ok 'Mathx::Stat::Probability';
Run with
perl6 -Ilib t/use.t
import Html | |
import Markdown | |
letter : Html msg | |
letter = | |
Markdown.toHtml [class "content"] """ | |
# Letter to Santa | |
I've been *real* **good** so I want this for Christmas | |
1. A Death Star. | |
2. A green unicorn. |
use Text::Markdown; | |
sub MAIN( Str $letter-to-santa = 'letters/dear-santa.md' ) { | |
my $letter = Text::Markdown::Document.new($letter-to-santa.IO.slurp()); | |
say so $letter.items.grep( { $^þ ~~ Text::Markdown::Heading } ); | |
} |
use Text::Markdown; | |
sub MAIN( Str $letter-to-santa = 'letters/dear-santa-sections.md' ) { | |
my $letter = Text::Markdown::Document.new($letter-to-santa.IO.slurp()); | |
my $flip = False; | |
my @paragraphs = $letter.items.grep( { $flip = ($^þ ~~ Text::Markdown::Heading and $^þ.level == 2)?? !$flip !! $flip } ); | |
say so any @paragraphs.map( {$^þ.Str ~~ /good/ } ); | |
} |
use Text::Markdown; | |
use JSON::Tiny; | |
sub MAIN( Str $letter-to-santa = 'letters/dear-santa-list.md' ) { | |
my $letter = Text::Markdown::Document.new($letter-to-santa.IO.slurp()); | |
my $flip = False; | |
my $list = $letter.items | |
.grep( { $flip = ( $flip | |
or so ($^þ ~~ Text::Markdown::Heading | |
and $^þ.level == 2 |
use JSON::Tiny; | |
use Wikidata::API; | |
sub MAIN( Str $toy-list = 'list.json' ) { | |
my $toys = from-json $toy-list.IO.slurp(); | |
say $toys.grep( { is-product( $^þ) } ); | |
} | |
sub is-product( Str $item ) { |
my Channel $c .= new; | |
my Channel $c2 = $c.Supply.batch( elems => 2).Channel; | |
my $count = 0; | |
$c.send($_) for ^40; | |
my $work = start react whenever $c -> $item { | |
$c.send( $item ); | |
say "This is $item"; | |
} |
Created this test file
use v6;
use Test;
use-ok 'Mathx::Stat::Probability';
Run with
perl6 -Ilib t/use.t
Christmas season was approaching, and Santa was in a gloomy mood. His inbox was full with letters from boys and girls coming from all over.
But.
Were they letter to Santa? Was the kid properly identified by signature, so that you sent the gifts to the proper person and not someone else who might
1234,Bobby Smith | |
1235,Rosa Felix | |
1236,Ramesh Patil | |
1245,Virginia Ryder | |
1356,Snively Witherspoon | |
1358,Burnedette Down | |
1366,Evelyn Tent |