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
CREATE TABLE patient ( | |
name text, | |
administrative_gender uuid references concept.concept_cid, | |
ethnicity uuid references concept.concept_cid, | |
phenotypic_sex_cid uuid references concept.concept_cid, | |
); | |
-- Parametric trigger for validating concept FK against sets of codesystems | |
-- concept_ind_codesystem(concept_field_name, array_of_codesystems) |
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 | |
sub character_differences(Str $str1, Str $str2) { | |
$str1.comb Z~~ $str2.comb | |
} | |
sub hamming_distance(Str $str1, Str $str2) { | |
my @differences = character_differences($str1, $str2); | |
return @differences.grep(* == False).elems; | |
} |
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
Time: <span id="clockDisplay"></span> |
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
say "Ohai!"; | |
for ^10 -> $stuff { | |
say $stuff if $stuff.is-prime; | |
} |
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 Stats; | |
sub bench($name, &code) { | |
my ($start,$end); | |
my @times; | |
for 1..100 { | |
$start = now; | |
code(); |
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 Terminal::Width; | |
sub is-mandelbrot(Complex $z0, int $max=100) { | |
my Complex $z = $z0; | |
for ^$max -> $n { | |
return $n if ($z.abs() > 2e0); | |
$z = $z**2 + $z0; | |
} | |
return $max; | |
} |
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 Compress::Zlib; | |
use IO::String; | |
my $DATA_DIR = %*ENV<DATA_DIR> // '/Users/matt/data/reference/GRCh37/sequence/dna'; | |
for dir($DATA_DIR).grep(/chr\d+\.fa\.gz/) -> $file { | |
my $out_file = $file.IO.extension('txt', :2parts).open(:w); | |
my $chromosome = IO::String.new(buffer=>gzslurp($file)); | |
for $chromosome.lines -> $line { |
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 Compress::Zlib; | |
use IO::String; | |
my $DATA_DIR = %*ENV<DATA_DIR> // '/Users/matt/data/reference/GRCh37/sequence/dna'; | |
for dir($DATA_DIR).grep(/chr\d+\.fa\.gz/) -> $file { | |
my $out_file = $file.IO.extension('txt', :2parts).open(:w); | |
my $chromosome = IO::String.new(buffer=>gzslurp($file)); | |
for $chromosome.lines -> $line { |
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 Compress::Zlib; | |
use IO::String; | |
my $DATA_DIR = %*ENV<DATA_DIR> // '/Users/matt/data/reference/GRCh37/sequence/dna'; | |
for dir($DATA_DIR).grep(/chr\d+\.fa\.gz/) -> $file { | |
my $out_file = $file.IO.extension('txt', :2parts).open(:w); | |
my $chromosome = IO::String.new(buffer=>gzslurp($file)); | |
for $chromosome.lines -> $line { |
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
1) every time you don't use sigils you are hogging namespace for something thats not variables. Something close to keywords like | |
"from" and "to" is a bad plan. I've seen several people including myself use "from $i to $j by $inc" as their own range/list constructing | |
syntax. I have no idea if Rakudo is smart enough to negotiate sigiless variables and keywords at the same time, Id almost hope its not! | |
2) to some extent it doesn't matter if the OP finds it easier to read or if you do, almost the entirety of code you will come | |
across will not use that convention. So learning that way to start out with is only going to cause pain working with others. Just wanting | |
to write a debug statement for that whats the simple plan? say "from {from} to {to}" not so clean given the norm for the language... You're | |
changing *semantics* for the sake of visual aesthetic not readability. Your intent is less clear given the language, its less readable but | |
perhaps prettier. | |
3) friendlier for the OP to learn a language which isn |