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 view ($file='todo.org') { | |
| my $todo=open "/home/echo/Dropbox/todo/$file"; | |
| my @lines= $todo.lines; | |
| $todo.close; | |
| say " there are "~ +@lines ~ " tasks"; | |
| my $order=1; | |
| for @lines -> $line { | |
| say "$order"~"."~"$line"; | |
| $order++; |
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
| multi MAIN('a'){ view ; add ;} | |
| multi MAIN('v'){ view ;} | |
| multi MAIN('d'){ done ;} | |
| multi MAIN('vd'){ viewdone;} |
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 MAIN ($op="v"){ #$op="v" eqv $op='v' | |
| my %All = v=>&view, a=>&add, d =>&done, vd=&viewdone; | |
| %All{$op}(); | |
| } |
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 Int $i = 2 * 10 ** 20_002; | |
| my Int $sqrt = 10 ** 10_001; | |
| my Int $next_sqrt = ($i div $sqrt + $sqrt) div 2; | |
| repeat { | |
| $sqrt = $next_sqrt; | |
| $next_sqrt = ($i div $sqrt + $sqrt) div 2; | |
| } until $sqrt == $next_sqrt; | |
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 Minstack { | |
| has @.stack; | |
| has @.min; | |
| method mpush($item) { | |
| push @.stack, $item; | |
| if @.min==0 or @.min[*-1] > $item { | |
| push @.min, $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
| class Minstack { | |
| has @.stack; | |
| has @.min; | |
| method mpush($item) { | |
| push @.stack, $item; | |
| if @.min==0 or @.min[*-1] > $item { | |
| push @.min, $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
| #todo how to use multi? | |
| class Minstack { | |
| has @.stack; | |
| has @.min; | |
| method mpush($item) { | |
| push @.stack, $item; | |
| if @.min==0 or @.min[*-1] > $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
| #todo how to use multi? | |
| class Minstack { | |
| has @!stack; | |
| has @!min; | |
| method mpush($item) { | |
| push @.stack, $item; | |
| if @.min==0 or @.min[*-1] > $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
| class Minstack { | |
| has @.stack; | |
| has @.min; | |
| } | |
| multi push(Minstack $mstack, $item) { | |
| push $mstack.stack, $item; | |
| if $mstack.min==0 or $mstack.min[*-1] > $item { | |
| push $mstack.min, $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
| sub deci_bin($n) { | |
| return $n if $n==0 || $n==1; | |
| my $k = $n div 2; | |
| my $b = $n % 2; | |
| my $E = deci_bin($k); | |
| return $E~$b; | |
| } | |
| sub automata($rule,$row) { |