This file contains 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 strict; | |
use warnings; | |
{ | |
package AsyncArrow; | |
use Scalar::Util qw/weaken/; | |
use AnyEvent; | |
use Exporter qw/import/; | |
use Class::Accessor::Lite new => 1, rw => ['code']; |
This file contains 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
import Control.Monad (forM_) | |
import Data.List.Split (splitOn) | |
import qualified Data.Map as M | |
import Data.Maybe (maybe) | |
import System.Environment (getArgs) | |
import System.IO (readFile) | |
parseLine :: String -> (String, Int) | |
parseLine str = let (key:count:_) = splitOn "\t" str | |
in (key, read count) |
This file contains 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 strict; | |
use warnings; | |
use Time::Piece; | |
{ | |
no warnings 'redefine'; | |
my $orig_strptime = \&Time::Piece::strptime; | |
*Time::Piece::strptime = sub { | |
my @warns; | |
my $result = do { |
This file contains 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
dummy |
This file contains 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 strict; | |
use warnings; | |
use Benchmark qw(cmpthese); | |
use Iterator::Simple qw(iter islice imap list); | |
my $n = 1000; | |
my $size = 10000; | |
my $start = $ARGV[0] // die; | |
my $end = $ARGV[1] // die; | |
my @list = (1 .. $size); |
This file contains 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
*~ |
This file contains 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 strict; | |
use warnings; | |
use Test::More; | |
use sort '_quicksort'; | |
sub test_sort () { | |
my @sorted = sort { $a->[1] <=> $b->[1] } map { [$_, $_ % 2] } 1 .. 100; | |
is_deeply \@sorted, [(map { [$_ * 2, 0] } 1 .. 50), (map { [$_ * 2 - 1, 1] } 1 .. 50)]; | |
} |
This file contains 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
module Main where | |
import Control.Monad (forM_) | |
import qualified Data.Map as M | |
import qualified Distribution.PackDeps as PD | |
import GHC.Exts (sortWith) | |
main :: IO () | |
main = do | |
ns <- PD.loadNewest |
This file contains 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 strict; | |
use warnings; | |
use Exporter qw(import); | |
our @EXPORTER = qw(solve); | |
sub lines ($) { 2 ** ($_[0] - 1) } | |
sub new_halls ($$) { | |
my ($b1, $b2) = @_; | |
lines $b1 * lines $b2; | |
} |
This file contains 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
package Seg; | |
use strict; | |
use warnings; | |
use Exporter qw(import); | |
our @EXPORT = qw(solve); | |
sub parse_char ($) { | |
my $c = shift; | |
(!! ($c & 04), !! ($c & 02), !! ($c & 01)); | |
} |
NewerOlder