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
#! /usr/bin/env perl | |
use strict; | |
use warnings; | |
use Benchmark; | |
sub arbitrary { | |
my @chars = ('A' .. 'Z', 'a' .. 'z', 0 .. 9); |
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
#! /usr/bin/env perl | |
use strict; | |
use warnings; | |
use 5.10.0; | |
my $record = qr/ | |
^ | |
(?&ws) |
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
if ($data =~ /^\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*(-?\d+)\s*$/) { | |
my($x,$y,$z) = ($1,$2,$3); | |
...; | |
} | |
else { | |
die "$0: $ARGV:$.: unexpected format"; | |
} |
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
@data = split /\s*,\s*/, $data; |
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
$/ = "\r\n"; | |
while (defined($data = <>)) { | |
chomp; | |
...; | |
} |
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
my @data = ( $data =~ m|(-?\d+),(-?\d+),(\-?\d+)\r| ); | |
($data) = (split "\r", $data); | |
my @data = split ',', $data; |
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
#include <sys/times.h> | |
#include <time.h> | |
float etime_(float *tarray) | |
{ | |
struct tms buf; | |
times(&buf); | |
tarray[0] = 1.0 * buf.tms_utime / CLOCKS_PER_SEC; | |
tarray[1] = 1.0 * buf.tms_stime / CLOCKS_PER_SEC; |
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
#! /bin/bash | |
if [ ! -n "$PREFIX" ]; then | |
echo "$0: no PREFIX defined!" 1>&2 | |
exit | |
fi | |
#if [ ! -d dist ]; then | |
# echo "$0: no dist directory. Have you built?" 1>&2 | |
# exit |
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 Message (message) where | |
message = "Hello, world!" |
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
multiples = foldr merge [] . map (nx [1..]) | |
where nx = flip (map . (*)) | |
merge xs [] = xs | |
merge [] ys = ys | |
merge xx@(x:xs) yy@(y:ys) | |
| x < y = x : merge xs yy | |
| x > y = y : merge xx ys | |
| otherwise = x : merge xs ys |
NewerOlder