chrislo-sourceclassifier 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest +0 -312
- data/Rakefile +2 -2
- data/sourceclassifier.gemspec +6 -6
- metadata +4 -316
- data/sources/gcc/ackermann.gcc-2.gcc +0 -93
- data/sources/gcc/ackermann.gcc-3.gcc +0 -20
- data/sources/gcc/ary.gcc +0 -40
- data/sources/gcc/binarytrees.gcc +0 -136
- data/sources/gcc/binarytrees.gcc-2.gcc +0 -140
- data/sources/gcc/binarytrees.gcc-3.gcc +0 -134
- data/sources/gcc/chameneos.gcc +0 -117
- data/sources/gcc/chameneos.gcc-2.gcc +0 -134
- data/sources/gcc/chameneos.gcc-3.gcc +0 -120
- data/sources/gcc/chameneosredux.gcc +0 -306
- data/sources/gcc/echo.gcc +0 -144
- data/sources/gcc/except.gcc +0 -52
- data/sources/gcc/fannkuch.gcc +0 -105
- data/sources/gcc/fannkuch.gcc-2.gcc +0 -94
- data/sources/gcc/fasta.gcc +0 -158
- data/sources/gcc/fasta.gcc-2.gcc +0 -132
- data/sources/gcc/fasta.gcc-3.gcc +0 -145
- data/sources/gcc/fasta.gcc-4.gcc +0 -141
- data/sources/gcc/fibo.gcc +0 -20
- data/sources/gcc/harmonic.gcc +0 -22
- data/sources/gcc/hash.gcc +0 -31
- data/sources/gcc/hash2.gcc +0 -38
- data/sources/gcc/heapsort.gcc +0 -72
- data/sources/gcc/hello.gcc-2.gcc +0 -12
- data/sources/gcc/hello.gcc-3.gcc +0 -20
- data/sources/gcc/knucleotide.gcc +0 -173
- data/sources/gcc/knucleotide.gcc-2.gcc +0 -168
- data/sources/gcc/lists.gcc +0 -226
- data/sources/gcc/magicsquares.gcc +0 -378
- data/sources/gcc/mandelbrot.gcc +0 -84
- data/sources/gcc/mandelbrot.gcc-2.gcc +0 -63
- data/sources/gcc/mandelbrot.gcc-3.gcc +0 -91
- data/sources/gcc/mandelbrot.gcc-4.gcc +0 -78
- data/sources/gcc/matrix.gcc +0 -66
- data/sources/gcc/message.gcc-2.gcc +0 -72
- data/sources/gcc/message.gcc-3.gcc +0 -64
- data/sources/gcc/methcall.gcc +0 -89
- data/sources/gcc/moments.gcc +0 -120
- data/sources/gcc/nbody.gcc +0 -142
- data/sources/gcc/nbody.gcc-2.gcc +0 -143
- data/sources/gcc/nbody.gcc-3.gcc +0 -142
- data/sources/gcc/nestedloop.gcc +0 -25
- data/sources/gcc/nsieve.gcc +0 -35
- data/sources/gcc/nsievebits.gcc-2.gcc +0 -37
- data/sources/gcc/nsievebits.gcc-3.gcc +0 -53
- data/sources/gcc/objinst.gcc +0 -95
- data/sources/gcc/partialsums.gcc +0 -86
- data/sources/gcc/partialsums.gcc-3.gcc +0 -81
- data/sources/gcc/partialsums.gcc-4.gcc +0 -68
- data/sources/gcc/pidigits.gcc +0 -105
- data/sources/gcc/primes.gcc +0 -75
- data/sources/gcc/prodcons.gcc +0 -86
- data/sources/gcc/random.gcc +0 -29
- data/sources/gcc/raytracer.gcc +0 -125
- data/sources/gcc/raytracer.gcc-2.gcc +0 -181
- data/sources/gcc/recursive.gcc +0 -68
- data/sources/gcc/recursive.gcc-2.gcc +0 -55
- data/sources/gcc/regexdna.gcc-2.gcc +0 -126
- data/sources/gcc/regexmatch.gcc +0 -136
- data/sources/gcc/revcomp.gcc +0 -85
- data/sources/gcc/revcomp.gcc-2.gcc +0 -88
- data/sources/gcc/revcomp.gcc-4.gcc +0 -71
- data/sources/gcc/reversefile.gcc +0 -103
- data/sources/gcc/reversefile.gcc-2.gcc +0 -56
- data/sources/gcc/sieve.gcc +0 -34
- data/sources/gcc/spectralnorm.gcc +0 -54
- data/sources/gcc/spellcheck.gcc +0 -72
- data/sources/gcc/spellcheck.gcc-2.gcc +0 -61
- data/sources/gcc/strcat.gcc +0 -38
- data/sources/gcc/sumcol.gcc-2.gcc +0 -98
- data/sources/gcc/sumcol.gcc-3.gcc +0 -22
- data/sources/gcc/sumcol.gcc-4.gcc +0 -18
- data/sources/gcc/sumcol.gcc-5.gcc +0 -32
- data/sources/gcc/takfp.gcc +0 -23
- data/sources/gcc/tcp-stream.gcc +0 -122
- data/sources/gcc/tcpecho.gcc +0 -122
- data/sources/gcc/tcpecho.gcc-2.gcc +0 -136
- data/sources/gcc/tcprequest.gcc +0 -122
- data/sources/gcc/threadring.gcc +0 -73
- data/sources/gcc/wc.gcc +0 -52
- data/sources/gcc/wc.gcc-2.gcc +0 -40
- data/sources/gcc/wc.gcc-3.gcc +0 -46
- data/sources/gcc/wordfreq.gcc-2.gcc +0 -85
- data/sources/perl/ackermann.perl +0 -28
- data/sources/perl/ackermann.perl-2.perl +0 -25
- data/sources/perl/ackermann.perl-3.perl +0 -20
- data/sources/perl/ackermann.perl-4.perl +0 -18
- data/sources/perl/ary.perl +0 -25
- data/sources/perl/ary.perl-2.perl +0 -23
- data/sources/perl/binarytrees.perl +0 -66
- data/sources/perl/binarytrees.perl-2.perl +0 -71
- data/sources/perl/chameneos.perl +0 -67
- data/sources/perl/echo.perl +0 -81
- data/sources/perl/except.perl +0 -73
- data/sources/perl/fannkuch.perl +0 -44
- data/sources/perl/fannkuch.perl-2.perl +0 -38
- data/sources/perl/fasta.perl +0 -112
- data/sources/perl/fasta.perl-2.perl +0 -135
- data/sources/perl/fasta.perl-4.perl +0 -122
- data/sources/perl/fibo.perl +0 -15
- data/sources/perl/fibo.perl-2.perl +0 -0
- data/sources/perl/fibo.perl-3.perl +0 -0
- data/sources/perl/harmonic.perl +0 -7
- data/sources/perl/hash.perl +0 -23
- data/sources/perl/hash.perl-2.perl +0 -17
- data/sources/perl/hash.perl-3.perl +0 -24
- data/sources/perl/hash2.perl +0 -16
- data/sources/perl/heapsort.perl +0 -65
- data/sources/perl/heapsort.perl-2.perl +0 -0
- data/sources/perl/hello.perl +0 -5
- data/sources/perl/knucleotide.perl-2.perl +0 -30
- data/sources/perl/lists.perl +0 -48
- data/sources/perl/mandelbrot.perl-2.perl +0 -32
- data/sources/perl/matrix.perl +0 -59
- data/sources/perl/matrix.perl-2.perl +0 -0
- data/sources/perl/matrix.perl-3.perl +0 -0
- data/sources/perl/message.perl +0 -27
- data/sources/perl/methcall.perl +0 -66
- data/sources/perl/moments.perl +0 -44
- data/sources/perl/nbody.perl +0 -108
- data/sources/perl/nestedloop.perl +0 -28
- data/sources/perl/nsieve.perl-2.perl +0 -41
- data/sources/perl/nsieve.perl-4.perl +0 -43
- data/sources/perl/nsievebits.perl +0 -37
- data/sources/perl/objinst.perl +0 -73
- data/sources/perl/partialsums.perl-3.perl +0 -31
- data/sources/perl/pidigits.perl +0 -52
- data/sources/perl/pidigits.perl-2.perl +0 -47
- data/sources/perl/process.perl +0 -50
- data/sources/perl/prodcons.perl +0 -47
- data/sources/perl/random.perl-4.perl +0 -17
- data/sources/perl/recursive.perl-2.perl +0 -57
- data/sources/perl/regexdna.perl +0 -48
- data/sources/perl/regexdna.perl-2.perl +0 -43
- data/sources/perl/regexdna.perl-3.perl +0 -50
- data/sources/perl/regexdna.perl-4.perl +0 -49
- data/sources/perl/regexdna.perl-5.perl +0 -42
- data/sources/perl/regexdna.perl-6.perl +0 -43
- data/sources/perl/regexmatch.perl +0 -35
- data/sources/perl/revcomp.perl-2.perl +0 -34
- data/sources/perl/reversefile.perl +0 -8
- data/sources/perl/reversefile.perl-2.perl +0 -0
- data/sources/perl/reversefile.perl-3.perl +0 -0
- data/sources/perl/sieve.perl +0 -23
- data/sources/perl/spectralnorm.perl-2.perl +0 -54
- data/sources/perl/spellcheck.perl +0 -24
- data/sources/perl/strcat.perl +0 -13
- data/sources/perl/strcat.perl-2.perl +0 -0
- data/sources/perl/sumcol.perl +0 -8
- data/sources/perl/takfp.perl +0 -23
- data/sources/perl/takfp.perl-3.perl +0 -20
- data/sources/perl/tcpecho.perl +0 -61
- data/sources/perl/tcprequest.perl +0 -61
- data/sources/perl/tcpstream.perl +0 -61
- data/sources/perl/threadring.perl +0 -55
- data/sources/perl/threadring.perl-2.perl +0 -43
- data/sources/perl/wc.perl +0 -20
- data/sources/perl/wc.perl-2.perl +0 -14
- data/sources/perl/wordfreq.perl +0 -22
- data/sources/perl/wordfreq.perl-3.perl +0 -0
- data/sources/perl/wordfreq.perl3.perl +0 -0
- data/sources/python/ackermann.python +0 -21
- data/sources/python/ary.python +0 -19
- data/sources/python/binarytrees.python +0 -39
- data/sources/python/binarytrees.python-3.python +0 -44
- data/sources/python/chameneos.python-6.python +0 -73
- data/sources/python/chameneosredux.python +0 -126
- data/sources/python/chameneosredux.python-2.python +0 -122
- data/sources/python/dispatch.python +0 -176
- data/sources/python/dispatch.python-2.python +0 -136
- data/sources/python/echo.python +0 -64
- data/sources/python/except.python +0 -62
- data/sources/python/fannkuch.python +0 -50
- data/sources/python/fannkuch.python-2.python +0 -54
- data/sources/python/fasta.python-2.python +0 -79
- data/sources/python/fibo.python +0 -17
- data/sources/python/fibo.python-2.python +0 -0
- data/sources/python/fibo.python-3.python +0 -0
- data/sources/python/harmonic.python-2.python +0 -9
- data/sources/python/hash.python +0 -21
- data/sources/python/hash.python-2.python +0 -0
- data/sources/python/hash2.python +0 -30
- data/sources/python/heapsort.python-3.python +0 -66
- data/sources/python/hello.python +0 -5
- data/sources/python/implicitode.python +0 -231
- data/sources/python/knucleotide.python +0 -55
- data/sources/python/lists.python +0 -44
- data/sources/python/magicsquares.python +0 -145
- data/sources/python/mandelbrot.python +0 -44
- data/sources/python/mandelbrot.python-2.python +0 -35
- data/sources/python/mandelbrot.python-3.python +0 -46
- data/sources/python/matrix.python +0 -34
- data/sources/python/matrix.python-2.python +0 -23
- data/sources/python/message.python +0 -24
- data/sources/python/message.python-2.python +0 -20
- data/sources/python/message.python-3.python +0 -19
- data/sources/python/meteor.python +0 -210
- data/sources/python/meteor.python-2.python +0 -192
- data/sources/python/methcall.python +0 -51
- data/sources/python/moments.python +0 -65
- data/sources/python/nbody.python +0 -123
- data/sources/python/nbody.python-2.python +0 -120
- data/sources/python/nestedloop.python +0 -24
- data/sources/python/nsieve.python +0 -27
- data/sources/python/nsieve.python-2.python +0 -23
- data/sources/python/nsieve.python-4.python +0 -25
- data/sources/python/nsievebits.python +0 -27
- data/sources/python/nsievebits.python-2.python +0 -43
- data/sources/python/objinst.python +0 -53
- data/sources/python/partialsums.python +0 -37
- data/sources/python/partialsums.python-2.python +0 -35
- data/sources/python/partialsums.python-3.python +0 -48
- data/sources/python/pidigits.python +0 -38
- data/sources/python/pidigits.python-3.python +0 -63
- data/sources/python/pidigits.python-4.python +0 -24
- data/sources/python/process.python +0 -51
- data/sources/python/process.python-2.python +0 -133
- data/sources/python/prodcons.python +0 -51
- data/sources/python/prodcons.python-2.python +0 -0
- data/sources/python/random.python +0 -27
- data/sources/python/raytracer.python +0 -203
- data/sources/python/recursive.python +0 -35
- data/sources/python/regexdna.python +0 -39
- data/sources/python/regexdna.python-2.python +0 -34
- data/sources/python/regexmatch.python +0 -36
- data/sources/python/revcomp.python-3.python +0 -31
- data/sources/python/reversefile.python +0 -13
- data/sources/python/reversefile.python-2.python +0 -0
- data/sources/python/reversefile.python-3.python +0 -0
- data/sources/python/sieve.python +0 -50
- data/sources/python/spectralnorm.python-2.python +0 -36
- data/sources/python/spellcheck.python +0 -17
- data/sources/python/strcat.python +0 -35
- data/sources/python/strcat.python-2.python +0 -0
- data/sources/python/sumcol.python-2.python +0 -0
- data/sources/python/sumcol.python-3.python +0 -0
- data/sources/python/takfp.python +0 -19
- data/sources/python/tcpecho.python +0 -67
- data/sources/python/tcprequest.python +0 -67
- data/sources/python/tcpstream.python +0 -67
- data/sources/python/threadring.python +0 -47
- data/sources/python/threadring.python-2.python +0 -40
- data/sources/python/threadring.python-3.python +0 -34
- data/sources/python/wc.python-2.python +0 -19
- data/sources/python/wordfreq.python +0 -43
- data/sources/python/wordfreq.python-2.python +0 -0
- data/sources/python/wordfreq.python-3.python +0 -28
- data/sources/python/wordfreq.python-4.python +0 -38
- data/sources/python/wordfreq.python-5.python +0 -39
- data/sources/ruby/ackermann.ruby +0 -17
- data/sources/ruby/ackermann.ruby-5.ruby +0 -153
- data/sources/ruby/ary.ruby +0 -22
- data/sources/ruby/binarytrees.ruby-2.ruby +0 -55
- data/sources/ruby/chameneos.ruby-2.ruby +0 -71
- data/sources/ruby/dispatch.ruby +0 -114
- data/sources/ruby/echo.ruby +0 -41
- data/sources/ruby/except.ruby +0 -61
- data/sources/ruby/except.ruby-2.ruby +0 -61
- data/sources/ruby/fannkuch.ruby +0 -42
- data/sources/ruby/fasta.ruby +0 -81
- data/sources/ruby/fibo.ruby +0 -15
- data/sources/ruby/harmonic.ruby-2.ruby +0 -15
- data/sources/ruby/hash.ruby +0 -19
- data/sources/ruby/hash2.ruby +0 -23
- data/sources/ruby/heapsort.ruby +0 -55
- data/sources/ruby/hello.ruby +0 -6
- data/sources/ruby/knucleotide.ruby-2.ruby +0 -44
- data/sources/ruby/lists.ruby +0 -46
- data/sources/ruby/mandelbrot.ruby-3.ruby +0 -63
- data/sources/ruby/matrix.ruby +0 -40
- data/sources/ruby/matrix.ruby-2.ruby +0 -30
- data/sources/ruby/message.ruby +0 -29
- data/sources/ruby/message.ruby-2.ruby +0 -24
- data/sources/ruby/meteor.ruby +0 -386
- data/sources/ruby/meteor.ruby-2.ruby +0 -561
- data/sources/ruby/methcall.ruby +0 -58
- data/sources/ruby/methcall.ruby-2.ruby +0 -54
- data/sources/ruby/moments.ruby +0 -64
- data/sources/ruby/nbody.ruby-2.ruby +0 -145
- data/sources/ruby/nestedloop.ruby +0 -22
- data/sources/ruby/nsieve.ruby +0 -36
- data/sources/ruby/nsieve.ruby-2.ruby +0 -25
- data/sources/ruby/nsievebits.ruby-2.ruby +0 -42
- data/sources/ruby/objinst.ruby +0 -58
- data/sources/ruby/partialsums.ruby +0 -39
- data/sources/ruby/pidigits.ruby +0 -92
- data/sources/ruby/pidigits.ruby-2.ruby +0 -109
- data/sources/ruby/prodcons.ruby +0 -41
- data/sources/ruby/random.ruby +0 -17
- data/sources/ruby/recursive.ruby-2.ruby +0 -53
- data/sources/ruby/regexdna.ruby +0 -32
- data/sources/ruby/regexdna.ruby-2.ruby +0 -38
- data/sources/ruby/regexmatch.ruby +0 -33
- data/sources/ruby/revcomp.ruby +0 -28
- data/sources/ruby/reversefile.ruby +0 -7
- data/sources/ruby/sieve.ruby +0 -30
- data/sources/ruby/spectralnorm.ruby +0 -48
- data/sources/ruby/spellcheck.ruby +0 -18
- data/sources/ruby/spellcheck.ruby-2.ruby +0 -0
- data/sources/ruby/strcat.ruby +0 -12
- data/sources/ruby/strcat.ruby-2.ruby +0 -12
- data/sources/ruby/sumcol.ruby +0 -12
- data/sources/ruby/sumcol.ruby-2.ruby +0 -5
- data/sources/ruby/takfp.ruby +0 -15
- data/sources/ruby/tcpecho.ruby +0 -45
- data/sources/ruby/tcprequest.ruby +0 -45
- data/sources/ruby/tcpstream.ruby +0 -45
- data/sources/ruby/threadring.ruby +0 -61
- data/sources/ruby/threadring.ruby-2.ruby +0 -33
- data/sources/ruby/wc.ruby +0 -15
- data/sources/ruby/wordfreq.ruby +0 -17
- data/sources/ruby/wordfreq.ruby2.ruby +0 -0
@@ -1,25 +0,0 @@
|
|
1
|
-
#!/usr/bin/perl
|
2
|
-
# $Id: ackermann.perl-2.perl,v 1.1 2005-04-04 14:56:35 bfulgham Exp $
|
3
|
-
# http://www.bagley.org/~doug/shootout/
|
4
|
-
|
5
|
-
# With help from Ernesto Hernandez-Novich
|
6
|
-
use integer;
|
7
|
-
|
8
|
-
# Note: If memoization were allowed in this program, we could
|
9
|
-
# do so by adding:
|
10
|
-
use Memoize;
|
11
|
-
memoize("Ack");
|
12
|
-
|
13
|
-
# in our quest for speed, we must get ugly:
|
14
|
-
# it helps reduce stack frame size a little bit
|
15
|
-
# from Leif Stensson
|
16
|
-
sub Ack {
|
17
|
-
return $_[0] ? ($_[1] ? Ack($_[0]-1, Ack($_[0], $_[1]-1))
|
18
|
-
: Ack($_[0]-1, 1))
|
19
|
-
: $_[1]+1;
|
20
|
-
}
|
21
|
-
|
22
|
-
my $NUM = $ARGV[0];
|
23
|
-
$NUM = 1 if ($NUM < 1);
|
24
|
-
my $ack = Ack(3, $NUM);
|
25
|
-
print "Ack(3,$NUM): $ack\n";
|
@@ -1,20 +0,0 @@
|
|
1
|
-
#!/usr/bin/perl
|
2
|
-
# $Id: ackermann.perl-3.perl,v 1.1 2005-04-27 16:51:28 greg-guest Exp $
|
3
|
-
# http://www.bagley.org/~doug/shootout/
|
4
|
-
|
5
|
-
# We avoid using memoize by inlining the cache
|
6
|
-
# from Thomas Drugeon
|
7
|
-
|
8
|
-
# in our quest for speed, we must get ugly:
|
9
|
-
# it helps reduce stack frame size a little bit
|
10
|
-
# from Leif Stensson
|
11
|
-
sub Ack {
|
12
|
-
$_[0] ? ($Ack[$_[0]][$_[1]] ||= $_[1] ? Ack($_[0]-1, Ack($_[0], $_[1]-1))
|
13
|
-
: Ack($_[0]-1, 1))
|
14
|
-
: $_[1]+1;
|
15
|
-
}
|
16
|
-
|
17
|
-
my $NUM = $ARGV[0];
|
18
|
-
$NUM = 1 if ($NUM < 1);
|
19
|
-
my $ack = Ack(3, $NUM);
|
20
|
-
print "Ack(3,$NUM): $ack\n";
|
@@ -1,18 +0,0 @@
|
|
1
|
-
#!/usr/bin/perl
|
2
|
-
# The Great Win32 Computer Language Shootout
|
3
|
-
# http://shootout.alioth.debian.org/
|
4
|
-
# modified by Isaac Gouy
|
5
|
-
|
6
|
-
use integer;
|
7
|
-
|
8
|
-
sub Ack {
|
9
|
-
my($M, $N) = @_;
|
10
|
-
return( $N + 1 ) if ($M == 0);
|
11
|
-
return( Ack($M - 1, 1) ) if ($N == 0);
|
12
|
-
Ack($M - 1, Ack($M, $N - 1));
|
13
|
-
}
|
14
|
-
|
15
|
-
my $NUM = $ARGV[0];
|
16
|
-
$NUM = 1 if ($NUM < 1);
|
17
|
-
my $ack = Ack(3, $NUM);
|
18
|
-
print "Ack(3,$NUM): $ack\n";
|
data/sources/perl/ary.perl
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
#!/usr/bin/perl
|
2
|
-
# $Id: ary.perl,v 1.2 2004-05-22 07:25:00 bfulgham Exp $
|
3
|
-
# http://www.bagley.org/~doug/shootout/
|
4
|
-
|
5
|
-
# this program is modified from:
|
6
|
-
# http://cm.bell-labs.com/cm/cs/who/bwk/interps/pap.html
|
7
|
-
# Timing Trials, or, the Trials of Timing: Experiments with Scripting
|
8
|
-
# and User-Interface Languages</a> by Brian W. Kernighan and
|
9
|
-
# Christopher J. Van Wyk.
|
10
|
-
|
11
|
-
my $n = @ARGV[0] || 1;
|
12
|
-
my @X;
|
13
|
-
my @Y;
|
14
|
-
|
15
|
-
my $last = $n - 1;
|
16
|
-
for my $i (0..$last) {
|
17
|
-
$X[$i] = $i + 1;
|
18
|
-
}
|
19
|
-
for my $k (0..999) {
|
20
|
-
for my $i (reverse 0..$last) {
|
21
|
-
$Y[$i] += $X[$i];
|
22
|
-
}
|
23
|
-
}
|
24
|
-
|
25
|
-
print "$Y[0] $Y[$last]\n";
|
@@ -1,23 +0,0 @@
|
|
1
|
-
#!/usr/bin/perl
|
2
|
-
# The Great Computer Language Shootout
|
3
|
-
# http://shootout.alioth.debian.org/
|
4
|
-
# Modified: 2005-06-18 Cosimo Streppone
|
5
|
-
|
6
|
-
use integer;
|
7
|
-
|
8
|
-
my $n = @ARGV[0] || 1;
|
9
|
-
my(@X, @Y, $i, $k);
|
10
|
-
my $last = $n - 1;
|
11
|
-
|
12
|
-
# Initialize @X list in a single step
|
13
|
-
@X = (1 .. $n);
|
14
|
-
|
15
|
-
# Execute 1000 times
|
16
|
-
for(0 .. 999) {
|
17
|
-
# Use of `$_' aliasing is faster than using a lexical var
|
18
|
-
# Also, there is no need to reverse (0 .. $last) list
|
19
|
-
$Y[$_] += $X[$_] for 0 .. $last;
|
20
|
-
}
|
21
|
-
|
22
|
-
print $Y[0], ' ', $Y[$last], "\n";
|
23
|
-
|
@@ -1,66 +0,0 @@
|
|
1
|
-
#!/usr/bin/perl
|
2
|
-
# The Computer Language Shootout
|
3
|
-
# http://shootout.alioth.debian.org/
|
4
|
-
#
|
5
|
-
# Contributed by Doug King
|
6
|
-
# Corrected by Heiner Marxen
|
7
|
-
|
8
|
-
use integer;
|
9
|
-
|
10
|
-
sub item_check {
|
11
|
-
my ($tree) = @_;
|
12
|
-
|
13
|
-
return $$tree[2] unless (defined $$tree[0]);
|
14
|
-
return $$tree[2] + item_check($$tree[0]) - item_check($$tree[1]);
|
15
|
-
}
|
16
|
-
|
17
|
-
|
18
|
-
sub bottom_up_tree {
|
19
|
-
my($item, $depth) = @_;
|
20
|
-
|
21
|
-
return [ undef, undef, $item ] if $depth <= 0;
|
22
|
-
return [ bottom_up_tree(2 * $item - 1, $depth - 1),
|
23
|
-
bottom_up_tree(2 * $item, $depth - 1),
|
24
|
-
$item ];
|
25
|
-
}
|
26
|
-
|
27
|
-
|
28
|
-
$n = shift @ARGV;
|
29
|
-
|
30
|
-
$min_depth = 4;
|
31
|
-
|
32
|
-
if ( ($min_depth + 2) > $n) {
|
33
|
-
$max_depth = $min_depth + 2;
|
34
|
-
} else {
|
35
|
-
$max_depth = $n;
|
36
|
-
}
|
37
|
-
|
38
|
-
$stretch_depth = $max_depth + 1;
|
39
|
-
|
40
|
-
$stretch_tree = bottom_up_tree(0, $stretch_depth);
|
41
|
-
print "stretch tree of depth $stretch_depth\t check: ", item_check($stretch_tree), "\n";
|
42
|
-
$stretch_tree = undef;
|
43
|
-
|
44
|
-
$long_lived_tree = bottom_up_tree(0, $max_depth);
|
45
|
-
|
46
|
-
$depth = $min_depth;
|
47
|
-
while( $depth <= $max_depth ) {
|
48
|
-
|
49
|
-
$iterations = 2 ** ($max_depth - $depth + $min_depth);
|
50
|
-
$check = 0;
|
51
|
-
|
52
|
-
for $i (1..$iterations) {
|
53
|
-
$temp_tree = bottom_up_tree($i, $depth);
|
54
|
-
$check += item_check($temp_tree);
|
55
|
-
$temp_tree = undef;
|
56
|
-
|
57
|
-
$temp_tree = bottom_up_tree(-$i, $depth);
|
58
|
-
$check += item_check($temp_tree);
|
59
|
-
$temp_tree = undef;
|
60
|
-
}
|
61
|
-
|
62
|
-
print $iterations * 2, "\t trees of depth $depth\t check: ", $check, "\n";
|
63
|
-
$depth += 2;
|
64
|
-
}
|
65
|
-
|
66
|
-
print "long lived tree of depth $max_depth\t check: ", item_check($long_lived_tree), "\n";
|
@@ -1,71 +0,0 @@
|
|
1
|
-
# The Computer Language Benchmarks Game
|
2
|
-
# http://shootout.alioth.debian.org/
|
3
|
-
#
|
4
|
-
# Contributed by Doug King
|
5
|
-
# Corrected by Heiner Marxen
|
6
|
-
# Tree-building made non-recursive by Steffen Mueller
|
7
|
-
|
8
|
-
use integer;
|
9
|
-
|
10
|
-
sub item_check {
|
11
|
-
my ($tree) = @_;
|
12
|
-
|
13
|
-
return $tree->[2] unless (defined $tree->[0]);
|
14
|
-
return $tree->[2] + item_check($tree->[0]) - item_check($tree->[1]);
|
15
|
-
}
|
16
|
-
|
17
|
-
|
18
|
-
sub bottom_up_tree {
|
19
|
-
my($depth) = @_;
|
20
|
-
|
21
|
-
my @pool;
|
22
|
-
push @pool, [undef, undef, -$_] foreach 0..2**$depth-1;
|
23
|
-
|
24
|
-
foreach my $exponent (reverse(0..($depth-1))) {
|
25
|
-
push @pool, [reverse(splice(@pool, 0, 2)), $_]
|
26
|
-
foreach reverse(-(2**$exponent-1) .. 0);
|
27
|
-
}
|
28
|
-
return $pool[0];
|
29
|
-
}
|
30
|
-
|
31
|
-
|
32
|
-
my $n = shift @ARGV;
|
33
|
-
|
34
|
-
my $min_depth = 4;
|
35
|
-
my $max_depth;
|
36
|
-
|
37
|
-
if ( ($min_depth + 2) > $n) {
|
38
|
-
$max_depth = $min_depth + 2;
|
39
|
-
} else {
|
40
|
-
$max_depth = $n;
|
41
|
-
}
|
42
|
-
|
43
|
-
{
|
44
|
-
my $stretch_depth = $max_depth + 1;
|
45
|
-
my $stretch_tree = bottom_up_tree($stretch_depth);
|
46
|
-
print "stretch tree of depth $stretch_depth\t check: ",
|
47
|
-
item_check($stretch_tree), "\n";
|
48
|
-
}
|
49
|
-
|
50
|
-
my $long_lived_tree = bottom_up_tree($max_depth);
|
51
|
-
|
52
|
-
my $depth = $min_depth;
|
53
|
-
while( $depth <= $max_depth ) {
|
54
|
-
my $iterations = 2 ** ($max_depth - $depth + $min_depth);
|
55
|
-
my $check = 0;
|
56
|
-
|
57
|
-
foreach my $i (1..$iterations) {
|
58
|
-
my $temp_tree = bottom_up_tree($depth);
|
59
|
-
$check += item_check($temp_tree);
|
60
|
-
|
61
|
-
$temp_tree = bottom_up_tree($depth);
|
62
|
-
$check += item_check($temp_tree);
|
63
|
-
}
|
64
|
-
|
65
|
-
print $iterations * 2, "\t trees of depth $depth\t check: ", $check, "\n";
|
66
|
-
$depth += 2;
|
67
|
-
}
|
68
|
-
|
69
|
-
print "long lived tree of depth $max_depth\t check: ",
|
70
|
-
item_check($long_lived_tree), "\n";
|
71
|
-
|
data/sources/perl/chameneos.perl
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
#########################################
|
2
|
-
# The Computer Language Shootout #
|
3
|
-
# http://shootout.alioth.debian.org/ #
|
4
|
-
# #
|
5
|
-
# Contributed by Jesse Millikan #
|
6
|
-
#########################################
|
7
|
-
|
8
|
-
use threads;
|
9
|
-
use threads::shared;
|
10
|
-
|
11
|
-
# Complement method is numerical based on Haskell version
|
12
|
-
my ($red, $yellow, $blue, $none) = (0,1,2,3);
|
13
|
-
|
14
|
-
# Count, signal and mutex are all $meetings
|
15
|
-
my $meetings : shared = $ARGV[0];
|
16
|
-
|
17
|
-
# Locked and updated by each thread when it ends
|
18
|
-
my $total_meetings : shared = 0;
|
19
|
-
|
20
|
-
# Colour communication variables
|
21
|
-
my $first : shared = $none;
|
22
|
-
my $second : shared = $none;
|
23
|
-
|
24
|
-
# $_ is thread on the outer map and color on the inner loop
|
25
|
-
map { $_->join } (map {
|
26
|
-
# async starts a new thread running the block given
|
27
|
-
async {
|
28
|
-
my ($color, $other_color) = ($_,$none);
|
29
|
-
my $met = 0;
|
30
|
-
|
31
|
-
# with 'redo', loop until 'last' is called
|
32
|
-
LIVE: {
|
33
|
-
|
34
|
-
# Meeting place
|
35
|
-
{
|
36
|
-
lock $meetings;
|
37
|
-
|
38
|
-
last LIVE if($meetings <= 0); # 'fade' by jumping out of the block
|
39
|
-
|
40
|
-
if($first != $none){
|
41
|
-
$other_color = $first;
|
42
|
-
$second = $color;
|
43
|
-
cond_signal $meetings;
|
44
|
-
$meetings -= 1;
|
45
|
-
$first = $none;
|
46
|
-
}
|
47
|
-
else
|
48
|
-
{
|
49
|
-
$first = $color;
|
50
|
-
cond_wait $meetings;
|
51
|
-
$other_color = $second;
|
52
|
-
}
|
53
|
-
} # Unlock the meeting place
|
54
|
-
|
55
|
-
$color = 3 - $color - $other_color if($color != $other_color);
|
56
|
-
$met++;
|
57
|
-
|
58
|
-
redo;
|
59
|
-
}
|
60
|
-
|
61
|
-
# Lock the total and add own to it before dying
|
62
|
-
lock $total_meetings;
|
63
|
-
$total_meetings += $met;
|
64
|
-
}
|
65
|
-
} ($blue, $red, $yellow, $blue));
|
66
|
-
|
67
|
-
print "$total_meetings\n";
|
data/sources/perl/echo.perl
DELETED
@@ -1,81 +0,0 @@
|
|
1
|
-
#!/usr/bin/perl
|
2
|
-
# $Id: echo.perl,v 1.1.1.1 2004-05-19 18:09:37 bfulgham Exp $
|
3
|
-
# http://www.bagley.org/~doug/shootout/
|
4
|
-
|
5
|
-
use Socket;
|
6
|
-
|
7
|
-
my $DATA = "Hello there sailor\n";
|
8
|
-
|
9
|
-
sub server_sock {
|
10
|
-
local *SS;
|
11
|
-
socket(SS, PF_INET, SOCK_STREAM, 0) or
|
12
|
-
die "server/socket ($!)";
|
13
|
-
setsockopt(SS, SOL_SOCKET, SO_REUSEADDR, pack("l", 1)) or
|
14
|
-
die "server/setsockopt ($!)";
|
15
|
-
bind(SS, sockaddr_in(0, INADDR_LOOPBACK)) or
|
16
|
-
die "server/bind ($!)";
|
17
|
-
listen(SS, 2);
|
18
|
-
return(*SS);
|
19
|
-
}
|
20
|
-
|
21
|
-
sub get_port {
|
22
|
-
local *SK = shift;
|
23
|
-
(sockaddr_in(getsockname(SK)))[0];
|
24
|
-
}
|
25
|
-
|
26
|
-
sub client_sock {
|
27
|
-
my $port = shift;
|
28
|
-
local *CS;
|
29
|
-
socket(CS, PF_INET, SOCK_STREAM, getprotobyname('tcp')) or
|
30
|
-
die "client/socket ($!)";
|
31
|
-
connect(CS, sockaddr_in($port, INADDR_LOOPBACK)) or
|
32
|
-
die "client/connect ($!)";
|
33
|
-
return(*CS);
|
34
|
-
}
|
35
|
-
|
36
|
-
sub echo_client {
|
37
|
-
my($N, $port) = @_;
|
38
|
-
local *SOCK = client_sock($port);
|
39
|
-
select(SOCK);
|
40
|
-
$| = 1;
|
41
|
-
for my $i (0..($N-1)) {
|
42
|
-
print $DATA;
|
43
|
-
my $ans = <SOCK>;
|
44
|
-
($ans eq $DATA) or die qq{client: "$DATA" ne "$ans"};
|
45
|
-
}
|
46
|
-
close SOCK;
|
47
|
-
}
|
48
|
-
|
49
|
-
sub echo_server {
|
50
|
-
my($N) = @_;
|
51
|
-
local *SSOCK = server_sock();
|
52
|
-
my $port = get_port(*SSOCK);
|
53
|
-
my $pid = fork;
|
54
|
-
defined $pid or die "server/fork ($!)";
|
55
|
-
if ($pid) {
|
56
|
-
# parent is server
|
57
|
-
local *CSOCK;
|
58
|
-
accept(CSOCK, SSOCK) or die "server/accept ($!)";
|
59
|
-
select(CSOCK);
|
60
|
-
$| = 1;
|
61
|
-
my $n = 0;
|
62
|
-
while (<CSOCK>) {
|
63
|
-
print $_;
|
64
|
-
$n += length($_);
|
65
|
-
}
|
66
|
-
select(STDOUT);
|
67
|
-
print "server processed $n bytes\n";
|
68
|
-
} else {
|
69
|
-
# child is client
|
70
|
-
echo_client($N, $port);
|
71
|
-
}
|
72
|
-
wait();
|
73
|
-
}
|
74
|
-
|
75
|
-
sub main {
|
76
|
-
my $N = $ARGV[0] || 1;
|
77
|
-
echo_server($N);
|
78
|
-
exit(0);
|
79
|
-
}
|
80
|
-
|
81
|
-
main();
|
data/sources/perl/except.perl
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
#!/usr/bin/perl
|
2
|
-
# $Id: except.perl,v 1.1.1.1 2004-05-19 18:09:43 bfulgham Exp $
|
3
|
-
# http://www.bagley.org/~doug/shootout/
|
4
|
-
|
5
|
-
use integer;
|
6
|
-
|
7
|
-
my $HI = 0;
|
8
|
-
my $LO = 0;
|
9
|
-
my $NUM = $ARGV[0];
|
10
|
-
$NUM = 1 if ($NUM < 1);
|
11
|
-
|
12
|
-
package Lo_Exception;
|
13
|
-
|
14
|
-
sub new {
|
15
|
-
bless({Val => shift}, __PACKAGE__);
|
16
|
-
}
|
17
|
-
|
18
|
-
package Hi_Exception;
|
19
|
-
|
20
|
-
sub new {
|
21
|
-
bless({Val => shift}, __PACKAGE__);
|
22
|
-
}
|
23
|
-
|
24
|
-
package main;
|
25
|
-
|
26
|
-
sub some_function {
|
27
|
-
my $num = shift;
|
28
|
-
eval {
|
29
|
-
&hi_function($num);
|
30
|
-
};
|
31
|
-
if ($@) {
|
32
|
-
die "We shouldn't get here ($@)";
|
33
|
-
}
|
34
|
-
}
|
35
|
-
|
36
|
-
sub hi_function {
|
37
|
-
my $num = shift;
|
38
|
-
eval {
|
39
|
-
&lo_function($num);
|
40
|
-
};
|
41
|
-
if (ref($@) eq "Hi_Exception") {
|
42
|
-
$HI++; # handle
|
43
|
-
} elsif ($@) {
|
44
|
-
die $@; # rethrow
|
45
|
-
}
|
46
|
-
}
|
47
|
-
|
48
|
-
sub lo_function {
|
49
|
-
my $num = shift;
|
50
|
-
eval {
|
51
|
-
&blowup($num);
|
52
|
-
};
|
53
|
-
if (ref($@) eq "Lo_Exception") {
|
54
|
-
$LO++; # handle
|
55
|
-
} elsif ($@) {
|
56
|
-
die $@; # rethrow
|
57
|
-
}
|
58
|
-
}
|
59
|
-
|
60
|
-
sub blowup {
|
61
|
-
my $num = shift;
|
62
|
-
if ($num % 2) {
|
63
|
-
die Lo_Exception->new(Num => $num);
|
64
|
-
} else {
|
65
|
-
die Hi_Exception->new(Num => $num);
|
66
|
-
}
|
67
|
-
}
|
68
|
-
|
69
|
-
$NUM = $ARGV[0];
|
70
|
-
while ($NUM--) {
|
71
|
-
&some_function($NUM);
|
72
|
-
}
|
73
|
-
print "Exceptions: HI=$HI / LO=$LO\n";
|