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)); | |
} |
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 Solver; | |
use strict; | |
use warnings; | |
use Exporter qw(import); | |
our @EXPORT = qw(solve); | |
sub hex_to_bin ($) { unpack 'B8', (pack 'C', hex $_[0]) } | |
sub split_bytes ($) { |
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 (main) where | |
import Control.Monad | |
import Control.Monad.Free | |
main :: IO () | |
main = print . runStream $ sourceString |==| reverseString |==| waitString | |
data Void | |
data StreamF i o next = |
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 DBI; | |
my $dbh = DBI->connect("dbi:mysql:OREDB", "ORE", "OREPASS"); | |
$dbh->do('create temporary table if not exists x (id int primary key, y int not null) engine=innodb'); | |
$dbh->do('create temporary table if not exists y (id int primary key, name varchar(123)) engine=innodb'); | |
$dbh->do("insert x values (1, 1)"); | |
$dbh->do("insert x values (2, 2)"); | |
$dbh->do("insert x values (3, 3)"); |
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 Monster(solve) where | |
import Prelude hiding (drop) | |
weak :: Char -> Maybe Char | |
weak 'B' = Just 'a' | |
weak 'D' = Just 'c' | |
weak 'F' = Just 'e' | |
weak 'H' = Just 'g' | |
weak 'J' = Just 'i' | |
weak 'L' = Just 'k' |
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
public class Test { | |
static final private boolean looksLikeTel (String maybeTel) { | |
return maybeTel.matches("^[0-9]+(-[0-9]+)*$") ? true : false; | |
} | |
static final public void main (String args[]) { | |
String tels[] = {"090-9012-3234", "0.123", "ABCDE"}; | |
for (String maybeTel: tels) { | |
System.out.println( | |
maybeTel + |
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 List::Util qw(sum); | |
use Exporter qw(import); | |
our @EXPORT = qw(solve); | |
sub max_pos { | |
die "Found an empty list" unless @_; | |
my ($pos, $cur) = (0, $_[0]); | |
for (1 .. $#_) { |
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 Dog; | |
use strict; | |
use warnings; | |
sub new { bless {}, shift } | |
sub name : lvalue { $_[0]->{name} } | |
package main; | |
use strict; | |
use warnings; | |
my $mydog = Dog->new; |
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
1; | |
package Hira; | |
sub hello { | |
my $name = $_[0]->{name}; | |
print("hello" . $name . "world"); | |
} | |
package Dan; | |
sub hello { |
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 Dice; | |
use strict; | |
use warnings; | |
use List::Util qw(reduce); | |
use Exporter qw(import); | |
our @EXPORT = qw(solve); | |
sub N{$_[2],$_[1],7-$_[0]}sub S{N N N @_}sub W{7-$_[1],$_[0],$_[2]}sub E{W W W @_} |