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
| Test Summary Report | |
| ------------------- | |
| t/nqp/44-try-catch.t (Wstat: 0 Tests: 9 Failed: 1) | |
| Failed test: 4 | |
| t/nqp/56-role.t (Wstat: 11 Tests: 0 Failed: 0) | |
| Non-zero wait status: 11 | |
| Parse errors: No plan found in TAP output | |
| t/nqp/78-shell.t (Wstat: 256 Tests: 3 Failed: 0) | |
| Non-zero exit status: 1 | |
| Parse errors: Bad plan. You planned 5 tests but ran 3. |
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 Γ($x) { | |
| 1 / < | |
| 0.00000_00000_00000_00002 -0.00000_00000_00000_00023 0.00000_00000_00000_00141 | |
| 0.00000_00000_00000_00119 -0.00000_00000_00000_11813 0.00000_00000_00001_22678 | |
| -0.00000_00000_00005_34812 -0.00000_00000_00020_58326 0.00000_00000_00510_03703 | |
| -0.00000_00000_03696_80562 0.00000_00000_07782_26344 0.00000_00001_04342_67117 | |
| -0.00000_00011_81274_57049 0.00000_00050_02007_64447 0.00000_00061_16095_10448 | |
| -0.00000_02056_33841_69776 0.00000_11330_27231_98170 -0.00000_12504_93482_14267 | |
| -0.00002_01348_54780_78824 0.00012_80502_82388_11619 -0.00021_52416_74114_95097 | |
| -0.00116_51675_91859_06511 0.00721_89432_46663_09954 -0.00962_19715_27876_97356 |
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 MONKEY_TYPING; | |
| sub combinations(Int $n, Int $k) { | |
| return [] if $k == 0; | |
| return () if $k > $n; | |
| gather { | |
| take [0, (1..^$n)[@$_]] for combinations($n-1, $k-1); | |
| take [(1..^$n)[@$_]] for combinations($n-1, $k ); | |
| } | |
| } |
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
| # for our tantrums | |
| my class X::TypeCheck { ... } | |
| my class List does Positional { # declared in BOOTSTRAP | |
| # class List is Iterable is Cool | |
| # has Mu $!items; # VM's array of our reified elements | |
| # has Mu $!flattens; # true if this list flattens its parcels | |
| # has Mu $!nextiter; # iterator for generating remaining elements | |
| method new(|) { |
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
| class Field { | |
| has Int $.modulus; | |
| has Bool @!grid; | |
| method postcircumfix:<( )>($i, $j) is rw { | |
| @!grid[ ($i % $.modulus) + $.modulus * ($j div $.modulus) ] | |
| } | |
| } | |
| my Field $f .= new: :modulus(100); |
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 MONKEY_TYPING; | |
| augment class Pair { | |
| method traverse () { | |
| self.key, | |
| self.value ~~ Pair ?? | |
| self.value.traverse !! self.value; | |
| } | |
| } | |
| my $list = [=>] 'Ⅰ' .. 'Ⅻ'; |
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 $genome = 'GCGGTTATGCACCGTTCAAATTAGCAAACCACTAAGCGACGTAGTCTGGATTGATTTCTCCCTACCAGTGACCCAAGACGCGTTAGTGAGTTAAGTTCATATCCAGTACCTGCCGCCCTCTGTACTTGGGCGTCCGATTCGCATGCTTACTCAGGTGGAGGACACGATAATCTGATTAAACTGAGCTAAACCAGGTGGAACCAGAAACCAGGTGGGGAGTCTCGCTTCAAGCCGTTCTTGCGATCAAACCAGGTGGTCCATTATGAAACCAGGTGGCTAAACCAGGTGGTCCAGATCCTCGAATGATGTCGGTGCACATCAAAACCAGGTGGGGTGGTGGAACGTAAAACCAGGTGGCATAAACCAGGTGGGCCGGTTCGTAAACCAGGTGAAACCAGGTGGGGTGGAAACCAGGTGGGTTACAAATTACGTTGAGATGGCCCAAACCAGGTGGTGGGCTTCACCCATGTCAACAAACCACCCTATGGAACTAAACCAGGTGGAACCAGGTGGTGAAGGCTTATCCTCAGGAAAAACCAGGTGGAGGTGGTGAAATAAAACCAGGTGGACCAGGTGGATAACCCTCGCCTCGCTTCTCAACCGAGACCTGGATAAACCAGGTGGGGTGGTCCACCGATTTTTGAGACACTAGAAACCAGGTGGGCGGGGAAACCAGGTGGCAAACCAGGTGGGGTGGACGGAAACCAGGTGGATATGTCATAAAACCAAACCAGGTGGTGCACCCCCATGGTGTGTCTTATCCGTGCGTATAAACCAGGTGGTCGCACGGCTTCCACTTGCTGAGAATAGGCCCGCAGGGTCAGTGCCATGCCCTCCGTCACTCGATATGTGTTGTAAGAGTGGTTACCCCTTCATTGAAGTCGCCCACAGCCCCACCTGCATTGCTAGACTATCACCCTACAGTAGGCCTTTTCGCCTTCTTCAAGCAGCAATCTCTTATCCGCGGATGGGCGCGGCGAGCGTGGCGTCCCCGAACATTTTTAC |
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
| constant ln2 = FatRat.new(11497654316995854314538600826176386914675840284781772934832310629025531009647835922483180950073671, 16587608864985500678430621519107217028770145595488224555912965535307732927005633645841205742796800); | |
| # [\+] map { 1.FatRat / 2**$_ / $_ }, 1 .. *; | |
| # FatRat.new(33636436125281008291653702688829128057940764118386796024399, 48527119591121290137917232399964930206766900113689699942400); | |
| subset AlmostInt of FatRat where -> $x { abs($x - $x.round) < .1 } | |
| sub h($n) returns FatRat { ([*] 2 .. $n) / (2*ln2**($n+1)) } | |
| for 1 .. 17 -> $n { |
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; | |
| constant number-of-decimals = 100; | |
| sub my-sqrt($n) { | |
| my Int $square = (10**(2*number-of-decimals) * $n).round; | |
| return FatRat.new: .[*-1], 10**number-of-decimals given | |
| 1, { ($_ + $square div $_) div 2 } ... * == * | |
| } |
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 sma($P) { | |
| sub { | |
| $P R/ do | |
| (state$ ) += $^x - | |
| (state@ = 0 xx $P).push($x).shift | |
| } | |
| } | |
| my &f = sma(3); | |
| for 0, .1 ... 1 { |